1999-09-11 20:40:09 +00:00
|
|
|
|
;;; winner.el --- Restore old window configurations
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2014-01-01 07:43:34 +00:00
|
|
|
|
;; Copyright (C) 1997-1998, 2001-2014 Free Software Foundation, Inc.
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2000-03-09 13:32:23 +00:00
|
|
|
|
;; Author: Ivar Rummelhoff <ivarru@math.uio.no>
|
1997-04-15 05:03:20 +00:00
|
|
|
|
;; Created: 27 Feb 1997
|
2000-03-07 10:10:40 +00:00
|
|
|
|
;; Keywords: convenience frames
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
1997-04-15 05:07:44 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1997-04-15 05:03:20 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
1997-04-15 05:07:44 +00:00
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1997-04-15 05:03:20 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
1997-08-27 04:13:52 +00:00
|
|
|
|
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
;; Winner mode is a global minor mode that records the changes in the
|
|
|
|
|
;; window configuration (i.e. how the frames are partitioned into
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; windows) so that the changes can be "undone" using the command
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
;; `winner-undo'. By default this one is bound to the key sequence
|
2004-05-03 23:17:41 +00:00
|
|
|
|
;; ctrl-c left. If you change your mind (while undoing), you can
|
|
|
|
|
;; press ctrl-c right (calling `winner-redo'). Even though it uses
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
;; some features of Emacs20.3, winner.el should also work with
|
|
|
|
|
;; Emacs19.34 and XEmacs20, provided that the installed version of
|
|
|
|
|
;; custom is not obsolete.
|
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; Winner mode was improved August 1998.
|
|
|
|
|
;; Further improvements February 2002.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
|
|
|
|
|
|
|
|
|
(defun winner-active-region ()
|
|
|
|
|
(declare (gv-setter (lambda (store)
|
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
`(if ,store (zmacs-activate-region)
|
|
|
|
|
(zmacs-deactivate-region))
|
2013-04-18 13:15:08 +00:00
|
|
|
|
`(if ,store (activate-mark) (deactivate-mark))))))
|
|
|
|
|
(region-active-p))
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2004-11-14 06:31:12 +00:00
|
|
|
|
(defalias 'winner-edges
|
|
|
|
|
(if (featurep 'xemacs) 'window-pixel-edges 'window-edges))
|
|
|
|
|
(defalias 'winner-window-list
|
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
|
(lambda () (delq (minibuffer-window) (window-list nil 0)))
|
|
|
|
|
(lambda () (window-list nil 0))))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(require 'ring)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2002-11-11 15:04:23 +00:00
|
|
|
|
(defgroup winner nil
|
|
|
|
|
"Restoring window configurations."
|
|
|
|
|
:group 'windows)
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
1998-02-25 00:28:55 +00:00
|
|
|
|
(defcustom winner-dont-bind-my-keys nil
|
2012-09-30 04:00:46 +00:00
|
|
|
|
"Non-nil means do not bind keys in Winner mode."
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
:type 'boolean
|
1998-02-25 00:28:55 +00:00
|
|
|
|
:group 'winner)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
(defcustom winner-ring-size 200
|
|
|
|
|
"Maximum number of stored window configurations per frame."
|
|
|
|
|
:type 'integer
|
1998-02-25 00:28:55 +00:00
|
|
|
|
:group 'winner)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(defcustom winner-boring-buffers '("*Completions*")
|
2012-09-29 23:52:03 +00:00
|
|
|
|
"List of buffer names whose windows `winner-undo' will not restore.
|
2002-02-26 16:09:19 +00:00
|
|
|
|
You may want to include buffer names such as *Help*, *Apropos*,
|
|
|
|
|
*Buffer List*, *info* and *Compile-Log*."
|
|
|
|
|
:type '(repeat string)
|
|
|
|
|
:group 'winner)
|
|
|
|
|
|
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
|
|
|
|
|
;;;; Saving old configurations (internal variables and subroutines)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;;; Current configuration
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; List the windows according to their edges.
|
|
|
|
|
(defun winner-sorted-window-list ()
|
|
|
|
|
(sort (winner-window-list)
|
|
|
|
|
(lambda (x y)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop for a in (winner-edges x)
|
|
|
|
|
for b in (winner-edges y)
|
|
|
|
|
while (= a b)
|
|
|
|
|
finally return (< a b)))))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
|
2003-02-04 12:29:42 +00:00
|
|
|
|
(defun winner-win-data ()
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; Essential properties of the windows in the selected frame.
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop for win in (winner-sorted-window-list)
|
|
|
|
|
collect (cons (winner-edges win) (window-buffer win))))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; This variable is updated with the current window configuration
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; every time it changes.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defvar winner-currents nil)
|
|
|
|
|
|
|
|
|
|
;; The current configuration (+ the buffers involved).
|
|
|
|
|
(defsubst winner-conf ()
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(cons (current-window-configuration)
|
|
|
|
|
(winner-win-data)))
|
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
;; Save current configuration.
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; (Called below by `winner-save-old-configurations').
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defun winner-remember ()
|
|
|
|
|
(let ((entry (assq (selected-frame) winner-currents)))
|
|
|
|
|
(if entry (setcdr entry (winner-conf))
|
|
|
|
|
(push (cons (selected-frame) (winner-conf))
|
|
|
|
|
winner-currents))))
|
|
|
|
|
|
|
|
|
|
;; Consult `winner-currents'.
|
|
|
|
|
(defun winner-configuration (&optional frame)
|
|
|
|
|
(or (cdr (assq (or frame (selected-frame)) winner-currents))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(with-selected-frame frame
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(winner-conf))))
|
|
|
|
|
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;;; Saved configurations
|
|
|
|
|
|
2011-07-14 01:09:00 +00:00
|
|
|
|
;; This variable contains the window configuration rings.
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
;; The key in this alist is the frame.
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(defvar winner-ring-alist nil)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
;; Find the right ring. If it does not exist, create one.
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(defsubst winner-ring (frame)
|
|
|
|
|
(or (cdr (assq frame winner-ring-alist))
|
2005-07-13 11:03:18 +00:00
|
|
|
|
(let ((ring (make-ring winner-ring-size)))
|
|
|
|
|
(ring-insert ring (winner-configuration frame))
|
|
|
|
|
(push (cons frame ring) winner-ring-alist)
|
|
|
|
|
ring)))
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
|
|
|
|
|
;; If the same command is called several times in a row,
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; we only save one window configuration.
|
|
|
|
|
(defvar winner-last-command nil)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; Frames affected by the previous command.
|
|
|
|
|
(defvar winner-last-frames nil)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2001-07-09 12:14:45 +00:00
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
(defsubst winner-equal (a b)
|
2002-02-26 16:09:19 +00:00
|
|
|
|
"Check whether two Winner configurations (as produced by
|
|
|
|
|
`winner-conf') are equal."
|
|
|
|
|
(equal (cdr a) (cdr b)))
|
2001-07-09 12:14:45 +00:00
|
|
|
|
|
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; Save the current window configuration, if it has changed.
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; If so return frame, otherwise return nil.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defun winner-insert-if-new (frame)
|
|
|
|
|
(unless (or (memq frame winner-last-frames)
|
|
|
|
|
(eq this-command 'winner-redo))
|
|
|
|
|
(let ((conf (winner-configuration frame))
|
|
|
|
|
(ring (winner-ring frame)))
|
|
|
|
|
(when (and (not (ring-empty-p ring))
|
|
|
|
|
(winner-equal conf (ring-ref ring 0)))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; When the previous configuration was very similar,
|
|
|
|
|
;; keep only the latest.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(ring-remove ring 0))
|
|
|
|
|
(ring-insert ring conf)
|
|
|
|
|
(push frame winner-last-frames)
|
|
|
|
|
frame)))
|
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Hooks
|
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; Frames affected by the current command.
|
|
|
|
|
(defvar winner-modified-list nil)
|
|
|
|
|
|
|
|
|
|
;; Called whenever the window configuration changes
|
|
|
|
|
;; (a `window-configuration-change-hook').
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(defun winner-change-fun ()
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(unless (or (memq (selected-frame) winner-modified-list)
|
|
|
|
|
(/= 0 (minibuffer-depth)))
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
(push (selected-frame) winner-modified-list)))
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; A `post-command-hook' for emacsen with
|
|
|
|
|
;; `window-configuration-change-hook'.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defun winner-save-old-configurations ()
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(when (zerop (minibuffer-depth))
|
|
|
|
|
(unless (eq this-command winner-last-command)
|
|
|
|
|
(setq winner-last-frames nil)
|
|
|
|
|
(setq winner-last-command this-command))
|
|
|
|
|
(dolist (frame winner-modified-list)
|
|
|
|
|
(winner-insert-if-new frame))
|
|
|
|
|
(setq winner-modified-list nil)
|
|
|
|
|
(winner-remember)))
|
|
|
|
|
|
|
|
|
|
;; A `minibuffer-setup-hook'.
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
(defun winner-save-unconditionally ()
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(unless (eq this-command winner-last-command)
|
|
|
|
|
(setq winner-last-frames nil)
|
|
|
|
|
(setq winner-last-command this-command))
|
|
|
|
|
(winner-insert-if-new (selected-frame))
|
|
|
|
|
(winner-remember))
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; A `post-command-hook' for other emacsen.
|
|
|
|
|
;; Also called by `winner-undo' before "undoing".
|
|
|
|
|
(defun winner-save-conditionally ()
|
|
|
|
|
(when (zerop (minibuffer-depth))
|
|
|
|
|
(winner-save-unconditionally)))
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
|
|
|
|
|
;;;; Restoring configurations
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
;; Works almost as `set-window-configuration',
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; but does not change the contents or the size of the minibuffer,
|
|
|
|
|
;; and tries to preserve the selected window.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defun winner-set-conf (winconf)
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(let* ((miniwin (minibuffer-window))
|
|
|
|
|
(chosen (selected-window))
|
|
|
|
|
(minisize (window-height miniwin)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-letf (((window-buffer miniwin))
|
|
|
|
|
((window-point miniwin)))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(set-window-configuration winconf))
|
|
|
|
|
(cond
|
|
|
|
|
((window-live-p chosen) (select-window chosen))
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 14:26:57 +00:00
|
|
|
|
((window-minibuffer-p) (other-window 1)))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
(when (/= minisize (window-height miniwin))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(with-selected-window miniwin
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(setf (window-height) minisize)))))
|
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar winner-point-alist nil)
|
|
|
|
|
;; `set-window-configuration' restores old points and marks. This is
|
|
|
|
|
;; not what we want, so we make a list of the "real" (i.e. new) points
|
|
|
|
|
;; and marks before undoing window configurations.
|
|
|
|
|
;;
|
|
|
|
|
;; Format of entries: (buffer (mark . mark-active) (window . point) ..)
|
|
|
|
|
|
|
|
|
|
(defun winner-make-point-alist ()
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(save-current-buffer
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop with alist
|
|
|
|
|
for win in (winner-window-list)
|
|
|
|
|
for entry =
|
|
|
|
|
(or (assq (window-buffer win) alist)
|
|
|
|
|
(car (push (list (set-buffer (window-buffer win))
|
|
|
|
|
(cons (mark t) (winner-active-region)))
|
|
|
|
|
alist)))
|
|
|
|
|
do (push (cons win (window-point win))
|
|
|
|
|
(cddr entry))
|
|
|
|
|
finally return alist)))
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
(defun winner-get-point (buf win)
|
|
|
|
|
;; Consult (and possibly extend) `winner-point-alist'.
|
2007-08-08 07:37:59 +00:00
|
|
|
|
;; Returns nil if buf no longer exists.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(when (buffer-name buf)
|
|
|
|
|
(let ((entry (assq buf winner-point-alist)))
|
|
|
|
|
(cond
|
|
|
|
|
(entry
|
|
|
|
|
(or (cdr (assq win (cddr entry)))
|
|
|
|
|
(cdr (assq nil (cddr entry)))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(with-current-buffer buf
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(push (cons nil (point)) (cddr entry))
|
|
|
|
|
(point))))
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(t (with-current-buffer buf
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(push (list buf
|
|
|
|
|
(cons (mark t) (winner-active-region))
|
|
|
|
|
(cons nil (point)))
|
|
|
|
|
winner-point-alist)
|
|
|
|
|
(point)))))))
|
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
|
|
|
|
|
;; Make sure point does not end up in the minibuffer and delete
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; windows displaying dead or boring buffers
|
2007-08-08 07:37:59 +00:00
|
|
|
|
;; (c.f. `winner-boring-buffers'). Return nil if all the windows
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; should be deleted. Preserve correct points and marks.
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(defun winner-set (conf)
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; For the format of `conf', see `winner-conf'.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(let* ((buffers nil)
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(alive
|
|
|
|
|
;; Possibly update `winner-point-alist'
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop for buf in (mapcar 'cdr (cdr conf))
|
|
|
|
|
for pos = (winner-get-point buf nil)
|
|
|
|
|
if (and pos (not (memq buf buffers)))
|
|
|
|
|
do (push buf buffers)
|
|
|
|
|
collect pos)))
|
Use list syntax for key definitions.
(winner-mode, winner-save-unconditionally)
(winner-hook-installed-p): Save window configuration after
every command if window-configuration-change-hook is not present.
(winner-save-new-configurations, winner-insert-if-new):
Compare a new window configuration
with the previous configuration before saving it.
(winner-insert-if-new, winner-ring)
(winner-configuration, winner-set): Save buffer list together
with the window configurations, so that windows that can no
longer be correctly restored can instead be deleted.
(winner-undo): Compare restored configuration
with other configurations that have been reviewed and skip
this one if it looks similar.
(winner-insert-if-new, winner-save-new-configurations)
(winner-save-unconditionally): Just save the final
configuration if the same command (changing the window
configuration) is applied several times in a row.
(winner-switch): Removed the command
`winner-switch' (and the variables connected to it), since
because of the change above, any "switching package" may now
be used without disturbing winner-mode too much.
(winner-change-fun): Removed the pushnew
command, so that `cl' will not have to be loaded.
(winner-set-conf): Introduced "wrapper" around
`set-window-configuration', so that `winner-undo' may be
called from the minibuffer.
1998-03-09 22:42:13 +00:00
|
|
|
|
(winner-set-conf (car conf))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(let (xwins) ; to be deleted
|
|
|
|
|
|
|
|
|
|
;; Restore points
|
|
|
|
|
(dolist (win (winner-sorted-window-list))
|
|
|
|
|
(unless (and (pop alive)
|
|
|
|
|
(setf (window-point win)
|
|
|
|
|
(winner-get-point (window-buffer win) win))
|
|
|
|
|
(not (member (buffer-name (window-buffer win))
|
|
|
|
|
winner-boring-buffers)))
|
|
|
|
|
(push win xwins))) ; delete this window
|
|
|
|
|
|
|
|
|
|
;; Restore marks
|
Provide generalized variables in core Elisp.
* lisp/emacs-lisp/gv.el: New file.
* lisp/subr.el (push, pop): Extend to generalized variables.
* lisp/loadup.el (macroexp): Unload if preloaded and uncompiled.
* lisp/emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
* lisp/emacs-lisp/cl-macs.el: Require gv. Use gv-define-setter,
gv-define-simple-setter, and gv-define-expander.
Remove setf-methods defined in gv. Rename cl-setf -> setf.
(cl-setf, cl-do-pop, cl-get-setf-method): Remove.
(cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
(cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
(cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
gv-letplace.
(cl-defstruct): Don't define setf-method any more.
* lisp/emacs-lisp/cl.el (flet): Don't autoload.
(cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
(define-setf-expander, defsetf, define-modify-macro)
(cl-struct-setf-expander): Move from cl-lib.el.
* lisp/emacs-lisp/syntax.el:
* lisp/emacs-lisp/ewoc.el:
* lisp/emacs-lisp/smie.el:
* lisp/emacs-lisp/cconv.el:
* lisp/emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
(timer--time): Use gv-define-simple-setter.
* lisp/emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
to avoid coding-system problems in subr.el. Adjust all users.
(macroexp--maxsize, macroexp-small-p): New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
* lisp/scroll-bar.el (scroll-bar-mode):
* lisp/simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode): Don't use the `eq' place.
* lisp/winner.el (winner-configuration, winner-make-point-alist)
(winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
* lisp/files.el (locate-file-completion-table): Avoid list*.
Fixes: debbugs:11657
2012-06-22 13:42:38 +00:00
|
|
|
|
(save-current-buffer
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop for buf in buffers
|
|
|
|
|
for entry = (cadr (assq buf winner-point-alist))
|
|
|
|
|
do (progn (set-buffer buf)
|
|
|
|
|
(set-mark (car entry))
|
|
|
|
|
(setf (winner-active-region) (cdr entry)))))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; Delete windows, whose buffers are dead or boring.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
;; Return t if this is still a possible configuration.
|
|
|
|
|
(or (null xwins)
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(progn
|
|
|
|
|
(mapc 'delete-window (cdr xwins)) ; delete all but one
|
|
|
|
|
(unless (one-window-p t)
|
|
|
|
|
(delete-window (car xwins))
|
|
|
|
|
t))))))
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;; Winner mode (a minor mode)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
1998-02-25 00:28:55 +00:00
|
|
|
|
(defcustom winner-mode-hook nil
|
2012-09-29 23:52:03 +00:00
|
|
|
|
"Functions to run whenever Winner mode is turned on or off."
|
1998-02-25 00:28:55 +00:00
|
|
|
|
:type 'hook
|
1998-02-25 05:06:02 +00:00
|
|
|
|
:group 'winner)
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2012-09-29 23:52:03 +00:00
|
|
|
|
(define-obsolete-variable-alias 'winner-mode-leave-hook
|
|
|
|
|
'winner-mode-off-hook "24.3")
|
|
|
|
|
|
|
|
|
|
(defcustom winner-mode-off-hook nil
|
1998-02-25 00:28:55 +00:00
|
|
|
|
"Functions to run whenever Winner mode is turned off."
|
|
|
|
|
:type 'hook
|
1998-02-25 05:06:02 +00:00
|
|
|
|
:group 'winner)
|
1997-08-27 04:13:52 +00:00
|
|
|
|
|
2004-11-14 06:31:12 +00:00
|
|
|
|
(defvar winner-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2012-09-30 04:00:46 +00:00
|
|
|
|
(unless winner-dont-bind-my-keys
|
|
|
|
|
(define-key map [(control c) left] 'winner-undo)
|
|
|
|
|
(define-key map [(control c) right] 'winner-redo))
|
2004-11-14 06:31:12 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for Winner mode.")
|
1997-04-15 05:07:44 +00:00
|
|
|
|
|
2000-03-07 10:10:40 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2012-09-29 23:52:03 +00:00
|
|
|
|
(define-minor-mode winner-mode nil :global t ; let d-m-m make the doc
|
|
|
|
|
(if winner-mode
|
|
|
|
|
(progn
|
2013-07-22 22:51:29 +00:00
|
|
|
|
(add-hook 'window-configuration-change-hook 'winner-change-fun)
|
|
|
|
|
(add-hook 'post-command-hook 'winner-save-old-configurations)
|
2012-09-29 23:52:03 +00:00
|
|
|
|
(add-hook 'minibuffer-setup-hook 'winner-save-unconditionally)
|
|
|
|
|
(setq winner-modified-list (frame-list))
|
|
|
|
|
(winner-save-old-configurations))
|
|
|
|
|
(remove-hook 'window-configuration-change-hook 'winner-change-fun)
|
|
|
|
|
(remove-hook 'post-command-hook 'winner-save-old-configurations)
|
|
|
|
|
(remove-hook 'minibuffer-setup-hook 'winner-save-unconditionally)))
|
1997-04-15 05:03:20 +00:00
|
|
|
|
|
2002-02-26 16:09:19 +00:00
|
|
|
|
;; Inspired by undo (simple.el)
|
1999-04-08 01:41:12 +00:00
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defvar winner-undo-frame nil)
|
|
|
|
|
|
1999-04-08 01:41:12 +00:00
|
|
|
|
(defvar winner-pending-undo-ring nil
|
2005-07-13 11:03:18 +00:00
|
|
|
|
"The ring currently used by `winner-undo'.")
|
1999-04-08 01:41:12 +00:00
|
|
|
|
(defvar winner-undo-counter nil)
|
|
|
|
|
(defvar winner-undone-data nil) ; There confs have been passed.
|
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(defun winner-undo ()
|
1997-08-27 04:13:52 +00:00
|
|
|
|
"Switch back to an earlier window configuration saved by Winner mode.
|
1999-09-11 20:40:09 +00:00
|
|
|
|
In other words, \"undo\" changes in window configuration."
|
|
|
|
|
(interactive)
|
1997-08-27 04:13:52 +00:00
|
|
|
|
(cond
|
|
|
|
|
((not winner-mode) (error "Winner mode is turned off"))
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(t (unless (and (eq last-command 'winner-undo)
|
|
|
|
|
(eq winner-undo-frame (selected-frame)))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(winner-save-conditionally) ; current configuration->stack
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(setq winner-undo-frame (selected-frame))
|
|
|
|
|
(setq winner-point-alist (winner-make-point-alist))
|
|
|
|
|
(setq winner-pending-undo-ring (winner-ring (selected-frame)))
|
|
|
|
|
(setq winner-undo-counter 0)
|
|
|
|
|
(setq winner-undone-data (list (winner-win-data))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-incf winner-undo-counter) ; starting at 1
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(when (and (winner-undo-this)
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 14:26:57 +00:00
|
|
|
|
(not (window-minibuffer-p)))
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(message "Winner undo (%d / %d)"
|
|
|
|
|
winner-undo-counter
|
|
|
|
|
(1- (ring-length winner-pending-undo-ring)))))))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-13 11:03:18 +00:00
|
|
|
|
|
|
|
|
|
(defun winner-undo-this () ; The heart of winner undo.
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-loop
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(cond
|
|
|
|
|
((>= winner-undo-counter (ring-length winner-pending-undo-ring))
|
|
|
|
|
(message "No further window configuration undo information")
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-return nil))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
((and ; If possible configuration
|
|
|
|
|
(winner-set (ring-ref winner-pending-undo-ring
|
|
|
|
|
winner-undo-counter))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
; .. and new configuration
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(let ((data (winner-win-data)))
|
|
|
|
|
(and (not (member data winner-undone-data))
|
|
|
|
|
(push data winner-undone-data))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(cl-return t)) ; .. then everything is fine.
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(t ;; Otherwise, discharge it (and try the next one).
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(ring-remove winner-pending-undo-ring winner-undo-counter)))))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
|
1999-09-11 20:40:09 +00:00
|
|
|
|
|
|
|
|
|
(defun winner-redo () ; If you change your mind.
|
1997-08-27 04:13:52 +00:00
|
|
|
|
"Restore a more recent window configuration saved by Winner mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(cond
|
|
|
|
|
((eq last-command 'winner-undo)
|
|
|
|
|
(winner-set
|
2002-02-26 16:09:19 +00:00
|
|
|
|
(if (zerop (minibuffer-depth))
|
|
|
|
|
(ring-remove winner-pending-undo-ring 0)
|
|
|
|
|
(ring-ref winner-pending-undo-ring 0)))
|
1999-09-11 20:40:09 +00:00
|
|
|
|
(unless (eq (selected-window) (minibuffer-window))
|
|
|
|
|
(message "Winner undid undo")))
|
2005-07-13 11:03:18 +00:00
|
|
|
|
(t (error "Previous command was not a `winner-undo'"))))
|
2002-02-26 16:09:19 +00:00
|
|
|
|
|
1997-04-15 05:03:20 +00:00
|
|
|
|
(provide 'winner)
|
1997-04-15 05:07:44 +00:00
|
|
|
|
;;; winner.el ends here
|