emacs-devel
[Top][All Lists]
Advanced

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

Re: feature proposal: change-log-exit: save change-log buffer and bury i


From: Uwe Brauer
Subject: Re: feature proposal: change-log-exit: save change-log buffer and bury it.
Date: Sun, 18 Oct 2015 10:01:18 +0300
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux)


   > 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")))))






reply via email to

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