From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: isearch multiple buffers Date: Sun, 20 Jul 2008 22:38:04 +0300 Organization: JURTA Message-ID: <874p6kuz1f.fsf@jurta.org> References: <87odfcggvl.fsf@jurta.org> <87prp9bae0.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216583465 8017 80.91.229.12 (20 Jul 2008 19:51:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jul 2008 19:51:05 +0000 (UTC) Cc: Thomas Link , emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 20 21:51:52 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KKewW-0006Wp-OH for ged-emacs-devel@m.gmane.org; Sun, 20 Jul 2008 21:51:41 +0200 Original-Received: from localhost ([127.0.0.1]:52379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKevd-0003Cf-Rb for ged-emacs-devel@m.gmane.org; Sun, 20 Jul 2008 15:50:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KKeur-0002s6-Rg for emacs-devel@gnu.org; Sun, 20 Jul 2008 15:49:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KKeur-0002rR-BI for emacs-devel@gnu.org; Sun, 20 Jul 2008 15:49:57 -0400 Original-Received: from [199.232.76.173] (port=40742 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKeuq-0002r7-Nn for emacs-devel@gnu.org; Sun, 20 Jul 2008 15:49:56 -0400 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]:50404) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KKeum-00016V-Bp; Sun, 20 Jul 2008 15:49:52 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1KKeuj-000A1E-Rr; Sun, 20 Jul 2008 22:49:50 +0300 In-Reply-To: (Richard M. Stallman's message of "Sun, 20 Jul 2008 13:21:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 3a67bbfa6cf9f2175436d007732bcc83 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 4378 [July 20 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101026 Archived-At: > whose single input argument accepts a list of files/buffers to search. > They then switch to the first file/buffer from this list and start > Isearch in it. > > It sounds good. But I would like to point out that you are developing > yet another way of specifying a set of buffers and then acting on > those buffers. In this case, the only kind of action is to search > them, at least so far. Maybe others could be added. Many Emacs packages already have different ways of specifying a set of buffers. For instance, buff-menu.el and ibuffer.el use the key `m' to mark a set of buffers, and other keys (like `x', `v') to operate on a set of marked buffers. I just added a new operation to the existing packages that specify a set of buffers. > There are other features of this general sort. One of them is > filesets. It was meant to provide a general solution for this kind of > thing, but it does not seem to have caught on much. Perhaps it is not > smoothly enough integrated with the rest of Emacs. filesets.el is a promising package with presently poor user interface. It displays a list of selected buffers only in the menu (not available when the menu is turned off) or in a Customize buffer that displays one customizable variable as a set of files. I think a better way to display filesets would be UI like provided by buffer-list, i.e. a special buffer that displays a set of files and allows easily doing operations on them. > Since you're starting on a new one, I wonder if you could turn this > into a convenient interface for doing various operations on the same > set of buffers. If we succeed in doing this, once and for all, it will > be a major step forward. On the www site of the filesets project I've found a file filesets2.el that contains features missing in the Emacs version of filesets.el. These features provide integration with dired and ibuffer: there are special commands to add a buffer from the ibuffer's buffer list to a fileset, and to add dired marked buffers to a fileset. I wonder why the author didn't include them to Emacs. Anyway, in the patch below I added Isearch operation on the filesets to filesets.el. And also fixed the existing multi-file query-replace operation to use new keys to skip the current file and to do automatic replacements in all remaining files (a feature implemented recently in a separate patch). It requires only adding `multi-query-replace-map' and using the standard function to read query-replace arguments `query-replace-read-args'. Index: lisp/filesets.el =================================================================== RCS file: /sources/emacs/emacs/lisp/filesets.el,v retrieving revision 1.39 diff -c -w -b -r1.39 filesets.el *** lisp/filesets.el 27 Jun 2008 07:34:46 -0000 1.39 --- lisp/filesets.el 20 Jul 2008 19:35:03 -0000 *************** *** 565,576 **** :group 'filesets) (defcustom filesets-commands ! `(("Query Replace" ! query-replace (filesets-cmd-query-replace-getargs)) ("Query Replace (regexp)" ! query-replace-regexp ! (filesets-cmd-query-replace-getargs)) ("Grep <>" "grep" ("-n " filesets-get-quoted-selection " " "<>")) --- 565,582 ---- :group 'filesets) (defcustom filesets-commands ! `(("Isearch" ! multi-isearch-files ! (filesets-cmd-isearch-getargs)) ! ("Isearch (regexp)" ! multi-isearch-files-regexp ! (filesets-cmd-isearch-getargs)) ! ("Query Replace" ! perform-replace (filesets-cmd-query-replace-getargs)) ("Query Replace (regexp)" ! perform-replace ! (filesets-cmd-query-replace-regexp-getargs)) ("Grep <>" "grep" ("-n " filesets-get-quoted-selection " " "<>")) *************** *** 1623,1628 **** --- 1629,1636 ---- (when files (let ((fn (filesets-cmd-get-fn cmd-name)) (args (filesets-cmd-get-args cmd-name))) + (if (memq fn '(multi-isearch-files multi-isearch-files-regexp)) + (apply fn args) (dolist (this files nil) (save-excursion (save-restriction *************** *** 1654,1660 **** (filesets-run-cmd--repl-fn this 'list))))))) ! (apply fn args)))))))))))))))) (defun filesets-get-cmd-menu () "Create filesets command menu." --- 1662,1668 ---- (filesets-run-cmd--repl-fn this 'list))))))) ! (apply fn args))))))))))))))))) (defun filesets-get-cmd-menu () "Create filesets command menu." *************** *** 1668,1683 **** ;;; sample commands (defun filesets-cmd-query-replace-getargs () "Get arguments for `query-replace' and `query-replace-regexp'." ! (let* ((from-string (read-string "Filesets query replace: " ! "" ! 'query-replace-history)) ! (to-string (read-string ! (format "Filesets query replace %s with: " from-string) ! "" ! 'query-replace-history)) ! (delimited (y-or-n-p ! "Filesets query replace: respect word boundaries? "))) ! (list from-string to-string delimited))) (defun filesets-cmd-shell-command-getargs () "Get arguments for `filesets-cmd-shell-command'." --- 1676,1694 ---- ;;; sample commands (defun filesets-cmd-query-replace-getargs () "Get arguments for `query-replace' and `query-replace-regexp'." ! (let ((common (query-replace-read-args "Filesets query replace" nil t))) ! (list (nth 0 common) (nth 1 common) t nil (nth 2 common) nil ! multi-query-replace-map))) ! ! (defun filesets-cmd-query-replace-regexp-getargs () ! "Get arguments for `query-replace' and `query-replace-regexp'." ! (let ((common (query-replace-read-args "Filesets query replace" t t))) ! (list (nth 0 common) (nth 1 common) t t (nth 2 common) nil ! multi-query-replace-map))) ! ! (defun filesets-cmd-isearch-getargs () ! "Get arguments for `multi-isearch-files' and `multi-isearch-files-regexp'." ! (list files)) (defun filesets-cmd-shell-command-getargs () "Get arguments for `filesets-cmd-shell-command'." -- Juri Linkov http://www.jurta.org/emacs/