all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Redundant left-over buffer after rename-buffer
@ 2013-02-23 11:55 Thorsten Jolitz
  2013-02-23 12:24 ` Thorsten Jolitz
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Jolitz @ 2013-02-23 11:55 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

I want to rename *Occur* buffers following the advice given in
`occur-rename-buffer' from `replace.el', with slightly modified and
renamed code:

,-------------------------------------------------------------------------------
| ;; slightly modified `occur-rename-buffer' from `replace.el'
| (defun navi-rename-buffer (&optional unique-p)
|   "Rename the current *Occur* buffer to *Navi: original-buffer-name*.
| Here `original-buffer-name' is the buffer name where 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-hook' if you always want a separate *Occur* buffer for
| each buffer where you invoke `occur'."
|   (with-current-buffer
|       (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*"))
|     (rename-buffer (concat "*Navi: "
|                            (mapconcat #'buffer-name
|                                       (car (cddr occur-revert-arguments)) "/")
|                            "*")
|                    unique-p)))
| 
| (add-to-list 'occur-hook 'navi-rename-buffer)
`-------------------------------------------------------------------------------

However, while the renaming works and the search results from occur are
presented in a buffer called *Navi: original-buffer-name*, an empty
*Occur* buffer in fundamental mood remains as a (redundant) left-over. 

  ,-------------------------------------
  | (kill-buffer (get-buffer "*Occur*"))
  `-------------------------------------

If I try to add the above function call as last statement into the
defun, I'm told that I'm trying to kill a non-existing buffer. 

How can I avoid (or get rid of) the left-over *Occur* buffer in
fundamental mode after the renaming operation?

-- 
cheers,
Thorsten





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-23 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-23 11:55 Redundant left-over buffer after rename-buffer Thorsten Jolitz
2013-02-23 12:24 ` Thorsten Jolitz

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.