emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing occur-hook to occur-functions


From: Juanma Barranquero
Subject: Re: Changing occur-hook to occur-functions
Date: Mon, 4 Jul 2005 06:02:49 +0200

On 7/3/05, Richard M. Stallman <address@hidden> wrote:
> Please use diff -c to send patches.  "Ordinary" diff lacks context
> and is therefore harder to understand.

The patch I proposed was this one.

-- 
                    /L/e/k/t/u

Index: lisp/replace.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/replace.el,v
retrieving revision 1.217
diff -c -r1.217 replace.el
*** lisp/replace.el     3 Jul 2005 22:49:00 -0000       1.217
--- lisp/replace.el     4 Jul 2005 03:59:50 -0000
***************
*** 921,941 ****
        (when current-prefix-arg
          (prefix-numeric-value current-prefix-arg))))
  
! (defun occur-rename-buffer (&optional unique-p)
    "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
  Here `original-buffer-name' is the buffer name were occur was originally run.
  When given the prefix argument, the renaming will not clobber the existing
  buffer(s) of that name, but use `generate-new-buffer-name' instead.
  You can add this to `occur-mode-hook' if you always want a separate *Occur*
  buffer for each buffer where you invoke `occur'."
!   (interactive "P")
    (with-current-buffer
        (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*"))
      (rename-buffer (concat "*Occur: "
                             (mapconcat #'buffer-name
                                        (car (cddr occur-revert-arguments)) "/")
                             "*")
!                    unique-p)))
  
  (defun occur (regexp &optional nlines)
    "Show all lines in the current buffer containing a match for REGEXP.
--- 921,941 ----
        (when current-prefix-arg
          (prefix-numeric-value current-prefix-arg))))
  
! (defun occur-rename-buffer (&optional unique-p interactive-p)
    "Rename the current *Occur* buffer to *Occur: original-buffer-name*.
  Here `original-buffer-name' is the buffer name were occur was originally run.
  When given the prefix argument, the renaming will not clobber the existing
  buffer(s) of that name, but use `generate-new-buffer-name' instead.
  You can add this to `occur-mode-hook' if you always want a separate *Occur*
  buffer for each buffer where you invoke `occur'."
!   (interactive "P\np")
    (with-current-buffer
        (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*"))
      (rename-buffer (concat "*Occur: "
                             (mapconcat #'buffer-name
                                        (car (cddr occur-revert-arguments)) "/")
                             "*")
!                    (or unique-p (not interactive-p)))))
  
  (defun occur (regexp &optional nlines)
    "Show all lines in the current buffer containing a match for REGEXP.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]