From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Redundant left-over buffer after rename-buffer Date: Sat, 23 Feb 2013 12:55:34 +0100 Message-ID: <87mwuvqm6h.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361620571 22632 80.91.229.3 (23 Feb 2013 11:56:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Feb 2013 11:56:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 23 12:56:31 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U9DiM-00044i-Kz for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 12:56:26 +0100 Original-Received: from localhost ([::1]:39120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9Di2-0000Wl-6u for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Feb 2013 06:56:06 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9Dhq-0000WO-N7 for help-gnu-emacs@gnu.org; Sat, 23 Feb 2013 06:56:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9Dhn-0000zh-OW for help-gnu-emacs@gnu.org; Sat, 23 Feb 2013 06:55:54 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:41201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9Dhn-0000zT-DX for help-gnu-emacs@gnu.org; Sat, 23 Feb 2013 06:55:51 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U9Di4-0003MW-Fl for help-gnu-emacs@gnu.org; Sat, 23 Feb 2013 12:56:08 +0100 Original-Received: from e178189148.adsl.alicedsl.de ([85.178.189.148]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 23 Feb 2013 12:56:08 +0100 Original-Received: from tjolitz by e178189148.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 23 Feb 2013 12:56:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178189148.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:88BXVbUtC+3qVkbWOaFMzS1a74g= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89239 Archived-At: 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