From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uwe Brauer Newsgroups: gmane.emacs.devel Subject: Re: feature proposal: change-log-exit: save change-log buffer and bury it. Date: Sun, 18 Oct 2015 10:01:18 +0300 Message-ID: <87k2qkoe2p.fsf@mat.ucm.es> References: <871tcwiqcp.fsf@mat.ucm.es> <561F89CF.303@yandex.ru> <83mvvk879j.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445151709 9748 80.91.229.3 (18 Oct 2015 07:01:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 18 Oct 2015 07:01:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 18 09:01:41 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZnhyO-00058L-3w for ged-emacs-devel@m.gmane.org; Sun, 18 Oct 2015 09:01:40 +0200 Original-Received: from localhost ([::1]:60895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnhyN-0004xg-EJ for ged-emacs-devel@m.gmane.org; Sun, 18 Oct 2015 03:01:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnhyJ-0004xM-7P for emacs-devel@gnu.org; Sun, 18 Oct 2015 03:01:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnhyG-0004tL-10 for emacs-devel@gnu.org; Sun, 18 Oct 2015 03:01:35 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnhyF-0004tH-QD for emacs-devel@gnu.org; Sun, 18 Oct 2015 03:01:31 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZnhyC-0004wH-02 for emacs-devel@gnu.org; Sun, 18 Oct 2015 09:01:28 +0200 Original-Received: from 192.115.67.55 ([192.115.67.55]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 18 Oct 2015 09:01:27 +0200 Original-Received: from oub by 192.115.67.55 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 18 Oct 2015 09:01:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 70 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 192.115.67.55 Mail-Copies-To: never User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:a9A6sx5SSJyp2jHHRPwggdDIPjY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:191913 Archived-At: > FWIW, I see no such function in any of the ChangeLog files, and "git > grep" reports no matches for it. > Uwe, are you sure there was such a function? Sorry for the delay in my answer. My memory did not serve me well. I thought this was in Emacs 19.34 but I could not find any working Emacs 19.34 version anymore. However it is a Xemacs function. (defun change-log-exit () "Save the change-log buffer, and restores the old window configuration. Buries the buffer." (interactive) (save-buffer) (let ((buf (current-buffer))) (pop-window-configuration) (bury-buffer buf))) The problem is bury-buffer, it is a C function from buffer.c that of course makes it more difficult to port to GNU Emacs. The definition of pop-window-configuration You find below. So the short question is: can such a functionality implemented easily I found it very useful. Right now I use (defadvice change-log-find-file (before savebury activate) "Save and kill the buffer before turning to source." (save-buffer 1) (kill-this-buffer)) Thanks Uwe (defun pop-window-configuration () "Pop the top window configuration off the window-config stack and set it. Before setting the new window configuration, the current window configuration is pushed onto the \"unpop\" stack. `unpop-window-configuration' undoes what this function does. Each frame has its own window-config and \"unpop\" stack." (interactive) (let ((stack (window-config-stack)) (wc (current-window-configuration)) popped) (condition-case nil (progn (setq popped (undoable-stack-pop stack)) (while (equal popped wc) (setq popped (undoable-stack-pop stack))) (undoable-stack-push stack wc) (undoable-stack-undo stack) (set-window-configuration popped) popped) (trunc-stack-bottom (error "Bottom of window config stack")))))