* [PATCH] PoC "make xconfig" Search Facility
@ 2006-03-27 19:50 Shlomi Fish
2006-03-28 18:43 ` Randy.Dunlap
2006-04-04 2:48 ` Kurt Wall
0 siblings, 2 replies; 6+ messages in thread
From: Shlomi Fish @ 2006-03-27 19:50 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]
Hi all!
[ I'm not subscribed to this list so please CC me on your replies. ]
This patch adds a proof-of-concept search facility to "make xconfig". Current
problems and limitations:
1. Only case-insensitive single-substring search is supported.
2. The style is completely wrong, as I could not find a suitable vim
configuration for editing Linux kernel source (and Google was not help). If
anyone can refer me to one, I'll be grateful.
3. At the moment the results are displayed in a listbox as text. One cannot go
from the result node to the place to toggle it in the configuration. (much
less from one of it ancessorts)
But it works!
The patch is against kernel 2.6.16-git13.
Comments, suggestions, corrections, and flames are welcome.
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish shlomif@iglu.org.il
Homepage: http://www.shlomifish.org/
95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.
[-- Attachment #2: xconfig-search-2.6.16-git13.patch --]
[-- Type: text/x-diff, Size: 5092 bytes --]
--- scripts/kconfig/qconf.cc.orig 2006-03-20 07:53:29.000000000 +0200
+++ scripts/kconfig/qconf.cc 2006-03-27 21:26:38.644408250 +0200
@@ -17,6 +17,10 @@
#include <qheader.h>
#include <qfiledialog.h>
#include <qregexp.h>
+#include <qdialog.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
#include <stdlib.h>
@@ -879,6 +883,8 @@
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
+ QAction *findAction = new QAction("Find", QPixmap(xpm_save), "&Find", CTRL+Key_F, this);
+ connect(findAction, SIGNAL(activated()), SLOT(findEntries()));
QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
showNameAction->setToggleAction(TRUE);
@@ -925,6 +931,11 @@
config->insertSeparator();
quitAction->addTo(config);
+ // create file menu
+ QPopupMenu* editMenu = new QPopupMenu(this);
+ menu->insertItem("&Edit", editMenu);
+ findAction->addTo(editMenu);
+
// create options menu
QPopupMenu* optionMenu = new QPopupMenu(this);
menu->insertItem("&Option", optionMenu);
@@ -1138,6 +1149,106 @@
QMessageBox::information(this, "qconf", "Unable to save configuration!");
}
+
+FindDialog::FindDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ main_layout = new QVBoxLayout(this, 11, 6, "main_layout");
+ main_layout->addWidget(new QLabel("Query:", this, "label1"));
+ queryLineEdit = new QLineEdit(this, "queryLineEdit");
+ main_layout->addWidget(queryLineEdit);
+ findButton = new QPushButton("Find", this, "findButton");
+ main_layout->addWidget(findButton);
+ connect( findButton, SIGNAL( clicked() ), this, SLOT( performQuery() ) );
+ results = new QListBox(this, "results");
+ main_layout->addWidget(results);
+}
+
+FindDialog::~FindDialog()
+{
+}
+
+static QString * get_parent_disp(struct menu * menu)
+{
+ QString s;
+ if (menu->sym)
+ {
+ if (menu->prompt)
+ {
+ s += menu->prompt->text;
+ if (menu->sym->name)
+ {
+ s += " (";
+ s += menu->sym->name;
+ s += ")";
+ }
+ }
+ else if (menu->sym->name)
+ {
+ s += menu->sym->name;
+ }
+ }
+ else if (menu->prompt)
+ {
+ s += menu->prompt->text;
+ }
+ return new QString(s);
+}
+
+void FindDialog::search(QString & query, struct menu * mymenu, MenuList * parents)
+{
+ struct symbol * sym;
+ struct menu * child;
+
+ MenuList new_parents(*parents);
+ new_parents.append(mymenu);
+
+ sym = mymenu->sym;
+
+ if (sym)
+ {
+ QString help(sym->help);
+ QString name(sym->name);
+
+ if (help.contains(query, FALSE) || name.contains(query, FALSE))
+ {
+ MenuList::iterator it;
+ QString item;
+ for (it = parents->begin(); it != parents->end() ; ++it)
+ {
+ QString * parent_disp = get_parent_disp(*it);
+ item += *parent_disp;
+ item += " -> ";
+ delete parent_disp;
+ }
+ QString * disp = get_parent_disp(mymenu);
+ item += *disp;
+ delete disp;
+ results->insertItem(item);
+ }
+ }
+ for (child = mymenu->list; child ; child = child->next)
+ {
+ search(query, child, &new_parents);
+ }
+}
+
+void FindDialog::performQuery(void)
+{
+ QString query = queryLineEdit->text();
+ results->clear();
+
+ MenuList parents;
+ search(query, &rootmenu, &parents);
+ // printf("Query for \"%s\"\n", (const char *)queryLineEdit->text());
+}
+
+void ConfigMainWindow::findEntries(void)
+{
+ FindDialog * dlg = new FindDialog(this, "dialog", TRUE);
+ dlg->exec();
+}
+
void ConfigMainWindow::saveConfigAs(void)
{
QString s = QFileDialog::getSaveFileName(".config", NULL, this);
--- scripts/kconfig/qconf.h.orig 2006-03-20 07:53:29.000000000 +0200
+++ scripts/kconfig/qconf.h 2006-03-27 21:26:38.648408500 +0200
@@ -4,6 +4,7 @@
*/
#include <qlistview.h>
+#include <qlistbox.h>
#if QT_VERSION >= 300
#include <qsettings.h>
#else
@@ -229,6 +230,7 @@
public slots:
void setHelp(QListViewItem* item);
void changeMenu(struct menu *);
+ void findEntries(void);
void listFocusChanged(void);
void goBack(void);
void loadConfig(void);
@@ -261,3 +263,22 @@
bool showDebug;
};
+
+typedef QValueList<struct menu *> MenuList;
+
+class FindDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ FindDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~FindDialog();
+ QVBoxLayout * main_layout;
+ QLineEdit * queryLineEdit;
+ QPushButton * findButton;
+ QListBox * results;
+public slots:
+ void performQuery();
+public:
+ void search(QString & query, struct menu * mymenu, MenuList * parents);
+};
+
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PoC "make xconfig" Search Facility
2006-03-27 19:50 [PATCH] PoC "make xconfig" Search Facility Shlomi Fish
@ 2006-03-28 18:43 ` Randy.Dunlap
2006-03-28 19:53 ` Shlomi Fish
2006-04-04 2:48 ` Kurt Wall
1 sibling, 1 reply; 6+ messages in thread
From: Randy.Dunlap @ 2006-03-28 18:43 UTC (permalink / raw)
To: Shlomi Fish; +Cc: linux-kernel
On Mon, 27 Mar 2006 21:50:41 +0200 Shlomi Fish wrote:
> Hi all!
>
> [ I'm not subscribed to this list so please CC me on your replies. ]
>
> This patch adds a proof-of-concept search facility to "make xconfig". Current
> problems and limitations:
>
> 1. Only case-insensitive single-substring search is supported.
>
> 2. The style is completely wrong, as I could not find a suitable vim
> configuration for editing Linux kernel source (and Google was not help). If
> anyone can refer me to one, I'll be grateful.
I don't know of a vim config for kernel source code.
Just read/use Documentation/CodingStyle, although for this code that probably
doesn't matter so much (since this isn't kernel run-time code).
> 3. At the moment the results are displayed in a listbox as text. One cannot go
> from the result node to the place to toggle it in the configuration. (much
> less from one of it ancessorts)
>
> But it works!
>
> The patch is against kernel 2.6.16-git13.
>
> Comments, suggestions, corrections, and flames are welcome.
Thanks. It's useful and a good start.
A one-line comment about how to invoke it would have been nice:
Use Edit/Find or Ctrl-F to invoke the search (find) tool.
To be really useful it needs to display items that SELECT the search string
IMO. Look at how menuconfig can do that.
E.g., for FW_LOADER (my favorite because it keeps me from disabling HOTPLUG
so often), using /FW_LOADER in menuconfig tells me what SELECTs FW_LOADER
as well as where it's defined.
Being able to enter more queries without leaving the dialog box is nice/good.
Oh, and patches should apply with 'patch -p1' (i.e., their filenames should
begin with linux-tree/scripts/ etc., not with scripts/*).
---
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PoC "make xconfig" Search Facility
2006-03-28 18:43 ` Randy.Dunlap
@ 2006-03-28 19:53 ` Shlomi Fish
2006-03-28 20:11 ` Randy.Dunlap
0 siblings, 1 reply; 6+ messages in thread
From: Shlomi Fish @ 2006-03-28 19:53 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
On Tuesday 28 March 2006 20:43, Randy.Dunlap wrote:
> On Mon, 27 Mar 2006 21:50:41 +0200 Shlomi Fish wrote:
> > Hi all!
> >
> > [ I'm not subscribed to this list so please CC me on your replies. ]
> >
> > This patch adds a proof-of-concept search facility to "make xconfig".
> > Current problems and limitations:
> >
> > 1. Only case-insensitive single-substring search is supported.
> >
> > 2. The style is completely wrong, as I could not find a suitable vim
> > configuration for editing Linux kernel source (and Google was not help).
> > If anyone can refer me to one, I'll be grateful.
>
> I don't know of a vim config for kernel source code.
Too bad. :(
> Just read/use Documentation/CodingStyle, although for this code that
> probably doesn't matter so much (since this isn't kernel run-time code).
Thing is when I enter tabs by default in Vim it uses 4 whitespace, and I need
it to insert a real tab. This is just an example, I want to edit this in
comfort.
Surely some kernel hackers use Vim, and someone must have come up with a vim
config for editing kernel source.
>
> > 3. At the moment the results are displayed in a listbox as text. One
> > cannot go from the result node to the place to toggle it in the
> > configuration. (much less from one of it ancessorts)
> >
> > But it works!
> >
> > The patch is against kernel 2.6.16-git13.
> >
> > Comments, suggestions, corrections, and flames are welcome.
>
> Thanks. It's useful and a good start.
Thanks.
>
> A one-line comment about how to invoke it would have been nice:
> Use Edit/Find or Ctrl-F to invoke the search (find) tool.
>
Where do you want this comment in? In the source code? In the application
itself? Somewhere else?
> To be really useful it needs to display items that SELECT the search string
> IMO. Look at how menuconfig can do that.
>
> E.g., for FW_LOADER (my favorite because it keeps me from disabling HOTPLUG
> so often), using /FW_LOADER in menuconfig tells me what SELECTs FW_LOADER
> as well as where it's defined.
Yes, I realise that. Of course implementing it in "make xconfig" would be
completely different than in "make menu config".
>
> Being able to enter more queries without leaving the dialog box is
> nice/good.
>
> Oh, and patches should apply with 'patch -p1' (i.e., their filenames should
> begin with linux-tree/scripts/ etc., not with scripts/*).
OK, I'll keep it in mind.
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish shlomif@iglu.org.il
Homepage: http://www.shlomifish.org/
95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PoC "make xconfig" Search Facility
2006-03-28 19:53 ` Shlomi Fish
@ 2006-03-28 20:11 ` Randy.Dunlap
2006-03-29 9:25 ` Shlomi Fish
0 siblings, 1 reply; 6+ messages in thread
From: Randy.Dunlap @ 2006-03-28 20:11 UTC (permalink / raw)
To: Shlomi Fish; +Cc: linux-kernel
On Tue, 28 Mar 2006 21:53:04 +0200 Shlomi Fish wrote:
> On Tuesday 28 March 2006 20:43, Randy.Dunlap wrote:
> > On Mon, 27 Mar 2006 21:50:41 +0200 Shlomi Fish wrote:
> > > Hi all!
> > >
> > > [ I'm not subscribed to this list so please CC me on your replies. ]
> > >
> > > This patch adds a proof-of-concept search facility to "make xconfig".
> > > Current problems and limitations:
> > >
> > > 1. Only case-insensitive single-substring search is supported.
> > >
> > > 2. The style is completely wrong, as I could not find a suitable vim
> > > configuration for editing Linux kernel source (and Google was not help).
> > > If anyone can refer me to one, I'll be grateful.
> >
> > I don't know of a vim config for kernel source code.
>
> Too bad. :(
>
> > Just read/use Documentation/CodingStyle, although for this code that
> > probably doesn't matter so much (since this isn't kernel run-time code).
>
> Thing is when I enter tabs by default in Vim it uses 4 whitespace, and I need
> it to insert a real tab. This is just an example, I want to edit this in
> comfort.
>
> Surely some kernel hackers use Vim, and someone must have come up with a vim
> config for editing kernel source.
Sure, lots of us do, but I'm not aware of an accepted vim config file for
kernel work. My vim doesn't use spaces for tabs, e.g.
And there are a few source files in the kernel with vi(m) settings in them.
Maybe that could help you.
> > > 3. At the moment the results are displayed in a listbox as text. One
> > > cannot go from the result node to the place to toggle it in the
> > > configuration. (much less from one of it ancessorts)
> > >
> > > But it works!
> > >
> > > The patch is against kernel 2.6.16-git13.
> > >
> > > Comments, suggestions, corrections, and flames are welcome.
> >
> > Thanks. It's useful and a good start.
>
> Thanks.
>
> >
> > A one-line comment about how to invoke it would have been nice:
> > Use Edit/Find or Ctrl-F to invoke the search (find) tool.
> >
>
> Where do you want this comment in? In the source code? In the application
> itself? Somewhere else?
Oh, just in your email mainly. and in the source code could help also.
> > To be really useful it needs to display items that SELECT the search string
> > IMO. Look at how menuconfig can do that.
> >
> > E.g., for FW_LOADER (my favorite because it keeps me from disabling HOTPLUG
> > so often), using /FW_LOADER in menuconfig tells me what SELECTs FW_LOADER
> > as well as where it's defined.
>
> Yes, I realise that. Of course implementing it in "make xconfig" would be
> completely different than in "make menu config".
Right, I just meant the use of it.
> > Being able to enter more queries without leaving the dialog box is
> > nice/good.
> >
> > Oh, and patches should apply with 'patch -p1' (i.e., their filenames should
> > begin with linux-tree/scripts/ etc., not with scripts/*).
>
> OK, I'll keep it in mind.
---
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PoC "make xconfig" Search Facility
2006-03-28 20:11 ` Randy.Dunlap
@ 2006-03-29 9:25 ` Shlomi Fish
0 siblings, 0 replies; 6+ messages in thread
From: Shlomi Fish @ 2006-03-29 9:25 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
On Tuesday 28 March 2006 22:11, Randy.Dunlap wrote:
> On Tue, 28 Mar 2006 21:53:04 +0200 Shlomi Fish wrote:
> > On Tuesday 28 March 2006 20:43, Randy.Dunlap wrote:
> > > On Mon, 27 Mar 2006 21:50:41 +0200 Shlomi Fish wrote:
> > > > Hi all!
> > > >
> > > > [ I'm not subscribed to this list so please CC me on your replies. ]
> > > >
> > > > This patch adds a proof-of-concept search facility to "make xconfig".
> > > > Current problems and limitations:
> > > >
> > > > 1. Only case-insensitive single-substring search is supported.
> > > >
> > > > 2. The style is completely wrong, as I could not find a suitable vim
> > > > configuration for editing Linux kernel source (and Google was not
> > > > help). If anyone can refer me to one, I'll be grateful.
> > >
> > > I don't know of a vim config for kernel source code.
> >
> > Too bad. :(
> >
> > > Just read/use Documentation/CodingStyle, although for this code that
> > > probably doesn't matter so much (since this isn't kernel run-time
> > > code).
> >
> > Thing is when I enter tabs by default in Vim it uses 4 whitespace, and I
> > need it to insert a real tab. This is just an example, I want to edit
> > this in comfort.
> >
> > Surely some kernel hackers use Vim, and someone must have come up with a
> > vim config for editing kernel source.
>
> Sure, lots of us do, but I'm not aware of an accepted vim config file for
> kernel work. My vim doesn't use spaces for tabs, e.g.
> And there are a few source files in the kernel with vi(m) settings in them.
> Maybe that could help you.
Thanks! I'll take a look.
>
> > > > 3. At the moment the results are displayed in a listbox as text. One
> > > > cannot go from the result node to the place to toggle it in the
> > > > configuration. (much less from one of it ancessorts)
> > > >
> > > > But it works!
> > > >
> > > > The patch is against kernel 2.6.16-git13.
> > > >
> > > > Comments, suggestions, corrections, and flames are welcome.
> > >
> > > Thanks. It's useful and a good start.
> >
> > Thanks.
> >
> > > A one-line comment about how to invoke it would have been nice:
> > > Use Edit/Find or Ctrl-F to invoke the search (find) tool.
> >
> > Where do you want this comment in? In the source code? In the application
> > itself? Somewhere else?
>
> Oh, just in your email mainly. and in the source code could help also.
>
I see. Well, I didn't see any comments for the other menu options. But I could
add one for the new feature somewhere.
> > > To be really useful it needs to display items that SELECT the search
> > > string IMO. Look at how menuconfig can do that.
> > >
> > > E.g., for FW_LOADER (my favorite because it keeps me from disabling
> > > HOTPLUG so often), using /FW_LOADER in menuconfig tells me what SELECTs
> > > FW_LOADER as well as where it's defined.
> >
> > Yes, I realise that. Of course implementing it in "make xconfig" would be
> > completely different than in "make menu config".
>
> Right, I just meant the use of it.
>
OK.
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish shlomif@iglu.org.il
Homepage: http://www.shlomifish.org/
95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] PoC "make xconfig" Search Facility
2006-03-27 19:50 [PATCH] PoC "make xconfig" Search Facility Shlomi Fish
2006-03-28 18:43 ` Randy.Dunlap
@ 2006-04-04 2:48 ` Kurt Wall
1 sibling, 0 replies; 6+ messages in thread
From: Kurt Wall @ 2006-04-04 2:48 UTC (permalink / raw)
To: linux-kernel
On Mon, Mar 27, 2006 at 09:50:41PM +0200, Shlomi Fish took 238 lines to write:
> Hi all!
>
> [ I'm not subscribed to this list so please CC me on your replies. ]
>
> This patch adds a proof-of-concept search facility to "make xconfig". Current
> problems and limitations:
>
> 1. Only case-insensitive single-substring search is supported.
That's a good start.
> 2. The style is completely wrong, as I could not find a suitable vim
> configuration for editing Linux kernel source (and Google was not help). If
> anyone can refer me to one, I'll be grateful.
Documentation/CodingStyle
scripts/Lindent
Kurt
--
Forgetfulness, n.:
A gift of God bestowed upon debtors in compensation for their
destitution of conscience.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-04-04 2:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-27 19:50 [PATCH] PoC "make xconfig" Search Facility Shlomi Fish
2006-03-28 18:43 ` Randy.Dunlap
2006-03-28 19:53 ` Shlomi Fish
2006-03-28 20:11 ` Randy.Dunlap
2006-03-29 9:25 ` Shlomi Fish
2006-04-04 2:48 ` Kurt Wall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.