all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: rms@gnu.org
Cc: Thomas Link <t.link@gmx.at>, emacs-devel@gnu.org
Subject: Re: isearch multiple buffers
Date: Sun, 20 Jul 2008 22:38:04 +0300	[thread overview]
Message-ID: <874p6kuz1f.fsf@jurta.org> (raw)
In-Reply-To: <E1KKcb0-0003LS-OF@fencepost.gnu.org> (Richard M. Stallman's message of "Sun, 20 Jul 2008 13:21:18 -0400")

>     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 <<selection>>"
       "grep"
       ("-n " filesets-get-quoted-selection " " "<<file-name>>"))
--- 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 <<selection>>"
       "grep"
       ("-n " filesets-get-quoted-selection " " "<<file-name>>"))
***************
*** 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/




  reply	other threads:[~2008-07-20 19:38 UTC|newest]

Thread overview: 164+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-06 19:52 isearch multiple buffers Juri Linkov
2007-10-07 15:37 ` Dan Nicolaescu
2007-10-08 18:03 ` Richard Stallman
2007-10-08 19:18   ` Juri Linkov
2007-10-08 19:59     ` Eric Hanchrow
2007-10-08 22:52       ` Juri Linkov
2007-10-11  9:25         ` Johan Bockgård
2007-10-11  9:45           ` Juri Linkov
2007-10-11 14:14             ` Stefan Monnier
2007-10-11 23:48               ` Juri Linkov
2007-10-11 17:41             ` Richard Stallman
2007-10-11 23:52               ` Juri Linkov
2007-10-12  8:42                 ` Johan Bockgård
2007-10-12 15:59                 ` Richard Stallman
2007-10-12 16:37                   ` Stefan Monnier
2007-10-20  0:08                   ` Juri Linkov
2007-10-21  7:26                     ` Richard Stallman
2007-10-21 20:37                       ` Juri Linkov
2007-10-21 23:39                         ` Miles Bader
2007-10-21 23:50                           ` Lennart Borgman (gmail)
2007-10-22  0:51                             ` Stefan Monnier
2007-10-22  1:01                               ` Miles Bader
2007-10-23  7:12                                 ` Richard Stallman
2007-10-23  8:17                                   ` David Kastrup
2007-10-23 17:53                                     ` Richard Stallman
2007-10-23 20:04                                       ` Eli Zaretskii
2007-10-23 21:44                                         ` Andreas Schwab
2007-10-24  4:22                                           ` Eli Zaretskii
2007-10-25  2:10                                             ` Richard Stallman
2007-10-24  8:33                                         ` Richard Stallman
2007-10-23 20:01                                   ` Eli Zaretskii
2007-10-23 23:33                                     ` Miles Bader
2007-10-24  0:52                                       ` Stefan Monnier
2007-10-24  4:18                                         ` Eli Zaretskii
2007-10-24  5:51                                           ` Stefan Monnier
2007-10-24 19:00                                             ` Eli Zaretskii
2007-10-24  4:16                                       ` Eli Zaretskii
2007-10-24  4:51                                         ` Miles Bader
2007-10-24 18:58                                           ` Eli Zaretskii
2007-10-24 23:55                                             ` Miles Bader
2007-10-25  4:15                                               ` Eli Zaretskii
2007-10-25  6:21                                                 ` Miles Bader
2007-10-25 20:55                                                   ` Juri Linkov
2007-10-25 21:42                                                   ` Eli Zaretskii
2007-10-25 11:02                                                 ` Robert J. Chassell
2007-10-25 22:08                                                   ` Eli Zaretskii
2007-10-26  1:30                                                     ` Robert J. Chassell
2007-10-26  9:32                                                       ` Eli Zaretskii
2007-10-26 10:05                                                         ` Robert J. Chassell
2007-10-29  0:08                                                     ` Michael Olson
2007-10-26 15:16                                                 ` Dan Nicolaescu
2007-10-26 15:32                                                   ` Juanma Barranquero
2007-10-26 15:36                                                     ` David Kastrup
2007-10-26 15:42                                                       ` Juanma Barranquero
2007-10-26 18:42                                                         ` Stefan Monnier
2007-10-26 19:23                                                           ` Eli Zaretskii
2007-10-26 18:52                                                         ` Eli Zaretskii
2007-10-26 18:49                                                       ` Eli Zaretskii
2007-10-26 19:21                                                   ` Eli Zaretskii
2007-10-26 19:41                                                     ` Dan Nicolaescu
2007-10-26 20:01                                                       ` Jason Rumney
2007-10-26 20:19                                                         ` David Kastrup
2007-10-26 20:01                                                       ` Eli Zaretskii
2007-10-26 20:38                                                       ` Stefan Monnier
2007-10-27 13:57                                                       ` Richard Stallman
2007-10-27 15:01                                                         ` Eli Zaretskii
2007-10-28 13:50                                                           ` Richard Stallman
2007-10-27 17:28                                                         ` Dan Nicolaescu
2007-10-27 22:16                                                           ` Eli Zaretskii
2007-10-28 13:50                                                           ` Richard Stallman
2007-10-28 13:50                                                           ` Richard Stallman
2007-10-28 16:45                                                             ` desupporting X10 and old X11 releases (was: Re: isearch multiple buffers) Dan Nicolaescu
2007-10-29  7:30                                                               ` desupporting X10 and old X11 releases Jan Djärv
2007-10-29 19:42                                                                 ` Eli Zaretskii
2007-10-30  7:33                                                                   ` Jan Djärv
2007-10-29 23:35                                                                 ` Richard Stallman
2007-10-30 13:52                                                                   ` Ulrich Mueller
2007-10-31  7:46                                                                     ` Richard Stallman
2007-10-29  9:21                                                               ` desupporting X10 and old X11 releases (was: Re: isearch multiple buffers) Richard Stallman
2007-10-29  9:21                                                               ` Richard Stallman
2007-10-28 18:38                                                             ` abandon K&R C ?(was: " Dan Nicolaescu
2007-10-29  9:21                                                               ` Richard Stallman
2007-10-29 19:46                                                                 ` Eli Zaretskii
2007-10-29 23:41                                                                   ` abandon K&R C ? Miles Bader
2007-10-29  7:21                                                             ` isearch multiple buffers Jan Djärv
2007-10-29 23:35                                                               ` Richard Stallman
2007-10-31  3:35                                                                 ` remove support for Sun windows (was Re: isearch multiple buffers) Dan Nicolaescu
2007-10-31 23:57                                                                   ` Richard Stallman
2007-11-01  3:09                                                                     ` Dan Nicolaescu
2007-11-01  7:44                                                                 ` isearch multiple buffers Jan Djärv
2007-11-09  8:26                                                             ` List of platforms to delete (was: Re: isearch multiple buffers) Dan Nicolaescu
2007-10-25  6:47                                               ` isearch multiple buffers martin rudalics
2007-10-25  7:02                                                 ` Miles Bader
2007-10-25  8:26                                                   ` Juanma Barranquero
2007-10-25 11:08                                                     ` David Kastrup
2007-10-25 11:19                                                       ` Juanma Barranquero
2007-10-25 14:03                                                         ` David Kastrup
2007-10-25 14:08                                                           ` Juanma Barranquero
2007-10-25 20:54                                                         ` Juri Linkov
2007-10-25 21:56                                                           ` Juanma Barranquero
2007-10-25  7:45                                                 ` 8.3 filename restriction Kenichi Handa
2007-10-25 10:53                                                   ` tomas
2007-10-25 22:01                                                     ` Eli Zaretskii
2007-10-25 12:36                                                   ` martin rudalics
2007-10-25 22:11                                                     ` Eli Zaretskii
2007-10-25 21:48                                                   ` Eli Zaretskii
2007-10-26  3:48                                                   ` Richard Stallman
2007-10-22  0:33                           ` isearch multiple buffers Juri Linkov
2007-10-22 23:48                             ` Juri Linkov
2007-10-23  7:12                         ` Richard Stallman
2007-10-23  7:12                         ` Richard Stallman
2007-10-23 23:59                           ` Juri Linkov
2007-10-24  0:32                             ` Drew Adams
2007-10-24 16:31                               ` buffer order [was: isearch multiple buffers] Drew Adams
2007-10-25  0:47                                 ` buffer order Miles Bader
2007-10-24 21:33                               ` isearch multiple buffers Juri Linkov
2007-10-24 22:52                                 ` Drew Adams
2007-10-24  8:33                             ` Richard Stallman
2007-10-24 21:23                               ` Juri Linkov
2007-10-25  9:01                                 ` Richard Stallman
2007-10-25 20:57                                   ` Juri Linkov
2007-10-25 21:51                                     ` Drew Adams
2007-10-26 23:05                                       ` Juri Linkov
2007-10-27  0:01                                         ` Lennart Borgman (gmail)
2007-10-27  0:19                                           ` Drew Adams
2007-10-27  7:22                                             ` Lennart Borgman (gmail)
2007-10-27 16:20                                               ` Drew Adams
2007-10-27 22:54                                                 ` Juri Linkov
2007-10-27 23:37                                                   ` Drew Adams
2007-10-28  1:31                                                     ` Juri Linkov
2007-10-28 13:50                                                   ` Richard Stallman
2007-10-28 15:03                                                     ` Juri Linkov
2007-10-29  9:21                                                       ` Richard Stallman
2007-10-27 23:41                                               ` Richard Stallman
2007-10-28  0:18                                                 ` Drew Adams
2007-10-28  1:32                                                   ` Juri Linkov
2007-10-28  3:22                                                     ` Drew Adams
2007-10-28  4:14                                                       ` Luc Teirlinck
2007-10-28 10:52                                                         ` Juri Linkov
2007-10-27  0:13                                         ` Drew Adams
2007-10-27  2:10                                           ` Miles Bader
2007-10-27  2:39                                             ` Drew Adams
2007-10-27  3:46                                               ` Miles Bader
2007-10-27  4:29                                                 ` Drew Adams
2007-10-27 23:27                                           ` Juri Linkov
2007-10-28  0:10                                             ` Drew Adams
2007-10-28  1:33                                               ` Juri Linkov
2007-10-27 13:58                                         ` Richard Stallman
2007-10-27 16:20                                           ` Drew Adams
2007-10-27 22:47                                             ` Juri Linkov
2007-10-27 23:26                                               ` Drew Adams
2007-10-28 13:51                                             ` Richard Stallman
2007-10-25  9:01                                 ` Richard Stallman
2007-10-09 20:03     ` Richard Stallman
2008-07-20  0:40 ` Juri Linkov
2008-07-20  4:11   ` Miles Bader
2008-07-20 19:34     ` Juri Linkov
2008-07-20 17:21   ` Richard M Stallman
2008-07-20 19:38     ` Juri Linkov [this message]
2008-07-21  3:29       ` Richard M Stallman
2008-07-21  9:07         ` Juri Linkov
2008-07-21  6:53       ` Thomas Link
2008-07-21  9:09         ` Juri Linkov
2008-07-21 10:42           ` Thomas Link

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874p6kuz1f.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=t.link@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.