From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#11151: 24.0.94; [PATCH] Winner-mode doesn't handle regexps for boring buffers. Date: Mon, 02 Apr 2012 09:21:53 +0200 Message-ID: <87limesini.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1333351389 15205 80.91.229.3 (2 Apr 2012 07:23:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Apr 2012 07:23:09 +0000 (UTC) To: 11151@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 02 09:23:08 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SEbbX-0006Nh-S2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 09:23:08 +0200 Original-Received: from localhost ([::1]:54275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbbT-0004WV-SY for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 03:23:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbbM-0004WD-G1 for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:23:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEbbD-0003QD-NG for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:22:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbbD-0003Q9-HG for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:22:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SEbbR-00071D-Kt for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Apr 2012 07:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11151 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133335136526955 (code B ref -1); Mon, 02 Apr 2012 07:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Apr 2012 07:22:45 +0000 Original-Received: from localhost ([127.0.0.1]:35290 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEbbA-00070h-4I for submit@debbugs.gnu.org; Mon, 02 Apr 2012 03:22:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36707) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SEbb6-00070Z-Ip for submit@debbugs.gnu.org; Mon, 02 Apr 2012 03:22:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEbam-0003GO-GQ for submit@debbugs.gnu.org; Mon, 02 Apr 2012 03:22:25 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:49929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbam-0003GC-9x for submit@debbugs.gnu.org; Mon, 02 Apr 2012 03:22:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbaf-0004T4-0b for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:22:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEbaa-0003DL-Uy for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:22:12 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:46511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEbaa-0003CS-IR for bug-gnu-emacs@gnu.org; Mon, 02 Apr 2012 03:22:08 -0400 Original-Received: by werj55 with SMTP id j55so1973721wer.0 for ; Mon, 02 Apr 2012 00:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=TcLgr5KjVCHlu6eyUFADz6jlnIY+eAw283/RpnyNvu4=; b=o6w+xU0Sp/9OyOY5M9xS22oy7bOpTim4MRlR67tmDzGbRH/h5XuGykOCM63raVpmAc jrG1pVCwKtVHWXaSYGG6t+4w436rXM1OeiF5DIaoTeVp7NdaDl5vWKznEAPM2MbyP2Di ukjvsIcW5wgsKEyiHBlavYz/C/TNk+WBaEby1HmAEv1CeD1Rohu2gtf3fXVExXJta7M6 zA2GiO9zsdB/DRfatEi2tI2p/OO9eHJhR6ZPn3rHGKmwCWjGpyCQfbWO0Hx/ZDRzeqkF mIfZpJa6VvNbjfYlaf6xyPa4gU+rkSJvVZrZ9Dr62UWhqXhuW6mUbAlClGcDppTFe0wQ l5Qw== Original-Received: by 10.180.107.101 with SMTP id hb5mr22133547wib.7.1333351325755; Mon, 02 Apr 2012 00:22:05 -0700 (PDT) Original-Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id gg2sm51725749wib.7.2012.04.02.00.22.03 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Apr 2012 00:22:05 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:58459 Archived-At: --=-=-= Content-Type: text/plain Hi, sometime it is not possible to use just `winner-boring-buffers' when a particular mode create lot of buffers like "*foo-mode-" or numbered buffers. here a patch to allow the use of regexp for boring buffers. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=patch-r119360.patch Content-Description: winner-mode boring buffers regexp # HG changeset patch # User Thierry Volpiatto # Date 1333350842 -7200 # Node ID 3fe612c045b96ff6ff7e4262d813fccb02fb0c3d # Parent 90804c9a8ede514915f792faaccbca9b43bf2dcc Extend boring buffers to regexps in winner-mode. (winner-boring-buffers-regexp): New user variable. (winner-set): Use it. diff --git a/lisp/winner.el b/lisp/winner.el --- a/lisp/winner.el +++ b/lisp/winner.el @@ -94,6 +94,11 @@ :type '(repeat string) :group 'winner) +(defcustom winner-boring-buffers-regexp nil + "`winner-undo' will not restore windows with buffers matching this regexp." + :type 'string + :group 'winner) + @@ -295,29 +300,35 @@ ;; Make sure point does not end up in the minibuffer and delete ;; windows displaying dead or boring buffers -;; (c.f. `winner-boring-buffers'). Return nil if all the windows -;; should be deleted. Preserve correct points and marks. +;; (c.f. `winner-boring-buffers', `winner-boring-buffers-regexp'). +;; Return nil if all the windows should be deleted. +;; Preserve correct points and marks. + (defun winner-set (conf) ;; For the format of `conf', see `winner-conf'. (let* ((buffers nil) (alive - ;; Possibly update `winner-point-alist' + ;; Possibly update `winner-point-alist' (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))) (winner-set-conf (car conf)) - (let (xwins) ; to be deleted + (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 + (unless (and (pop alive) + (setf (window-point win) + (winner-get-point (window-buffer win) win)) + (not (or (member (buffer-name (window-buffer win)) + winner-boring-buffers) + (and winner-boring-buffers-regexp + (string-match + winner-boring-buffers-regexp + (buffer-name (window-buffer win))))))) + (push win xwins))) ; delete this window ;; Restore marks (letf (((current-buffer))) @@ -330,10 +341,10 @@ ;; Return t if this is still a possible configuration. (or (null xwins) (progn - (mapc 'delete-window (cdr xwins)) ; delete all but one - (unless (one-window-p t) - (delete-window (car xwins)) - t)))))) + (mapc 'delete-window (cdr xwins)) ; delete all but one + (unless (one-window-p t) + (delete-window (car xwins)) + t)))))) --=-=-= Content-Type: text/plain In GNU Emacs 24.0.94.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2012-04-01 on thierry-MM061 Windowing system distributor `The X.Org Foundation', version 11.0.11004000 Configured using: `configure '--with-x-toolkit=lucid' '--without-rsvg' '--without-gconf' '--with-wide-int'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_FR.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: display-battery-mode: t global-undo-tree-mode: t undo-tree-mode: t auto-image-file-mode: t show-paren-mode: t display-time-mode: t savehist-mode: t minibuffer-depth-indicate-mode: t eldoc-mode: t helm-mode: t helm-dired-mode: Enable helm completion in Dired functions. Bindings affected are C, R, S, H. This is deprecated for Emacs24+ users, use `helm-mode' instead. shell-dirtrack-mode: t diff-auto-refine-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: q C-x C-s C-x c q E x t e n d SPC b o r i n g SPC s t o SPC M-( M-y M-y : SPC N e w SPC u s e r SPC v a r i a b l e . M-( w i n n e r - s e t : SPC U s e SPC i t . C-c C-c C-x c q C-e . p a t c h M-x r e p Recent messages: (No changes need to be saved) Edit the message and hit C-c C-c to accept it. Saving file /tmp/xhg-qrefresh10974s8O... Wrote /tmp/xhg-qrefresh10974s8O Exported revision 119360 to /home/thierry/labo/emacs-hg-qp/patch-r119360.patch. Load-path shadows: ~/elisp/emacs-helm-extensions/helm-descbinds hides ~/elisp/emacs-helm/helm-descbinds ~/elisp/org-active/contrib/lisp/org-eshell hides /usr/local/share/emacs/24.0.94/lisp/org/org-eshell ~/elisp/org-active/contrib/lisp/org-odt hides /usr/local/share/emacs/24.0.94/lisp/org/org-odt ~/elisp/org-active/contrib/lisp/org-lparse hides /usr/local/share/emacs/24.0.94/lisp/org/org-lparse ~/elisp/emms/lisp/tq hides /usr/local/share/emacs/24.0.94/lisp/emacs-lisp/tq Features: (shadow gnus-dired nnir mail-extr gnus-msg emacsbug sendmail helm-ring newcomment helm-elisp cl-specs edebug helm-eval time-stamp find-func winner helm-command animate tabify org-table make-mode vc-rcs sh-script generic xhg-dvc vc-git xgit-dvc xgit xgit-annotate dvc-annotate xgit-log dvc-revlist bzr-core xdarcs-core xgit-core xmtn-minimal naquadah-theme em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner em-alias esh-var esh-io esh-cmd esh-ext esh-proc esh-groups eshell esh-module esh-mode align-let server battery undo-tree slime-xref-browser slime-banner slime-tramp slime-asdf slime-fancy slime-fontifying-fu slime-package-fu slime-references slime-scratch slime-presentations slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-repl image-file newsticker newst-treeview tree-widget newst-plainview newst-reader newst-ticker newst-backend xdvi-search preview-latex pcomplete-extension em-term term ehelp electric pdbtrack whitespace paren time mime-w3m mime eword-decode mel path-util mime-parse std11 luna mime-def mcharset mcs-20 mcs-e20 pces pces-e20 pces-20 broken pcustom poe w3m-load avoid help-mode view savehist gnus-async nntp markdown-mode org-google-weather google-weather url-cache googlecl google-maps google-maps-static google-maps-geocode google-maps-base json simple-call-tree el-expectations el-mock csv2org iedit rect zop-to-char mule-util alist pym static apel-ver product elscreen smallurl mm-url rectangle-utils tv-utils pcvs pcvs-parse pcvs-info pcvs-defs pcvs-util mb-depth ioccur cl-info slime hyperspec slime-autoloads ledger-config ledger esh-arg esh-util tex-site auto-loads esh-toggle flymake eldoc-eval eldoc no-word regex-tool dired-extension emms-mpd-config emms-playlist-limit emms-volume emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-lastfm-client emms-lastfm-scrobbler parse-time emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time emms-lyrics emms-url hl-line emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer emms-info emms-streams later-do emms-source-playlist emms-source-file emms-player-simple emms-setup emms emms-compat dvc-init bzr-gnus tla-gnus xgit-gnus xhg-gnus gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader dvc-gnus tla-core tla-autoconf tla-defs dvc-log vc vc-dispatcher add-log ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff dvc-autoloads htmlize-hack htmlize muse-colors muse-docbook muse-texinfo texnfo-upd texinfo muse-latex muse-html muse-xml-common muse-wiki cus-edit cus-start cus-load muse-publish muse-project muse-protocols muse-regexps muse muse-nested-tags muse-mode muse-autoloads org-config-thierry ob-sh org-crypt cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs vc-hg org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-agenda appt diary-lib diary-loaddefs org-annotation-helper org-capture org-mks remember org-remember org-datetree config-w3m w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb w3m-ems wid-edit w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util addressbook-bookmark message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol bookmark-uzbl-handler bookmark-firefox-handler bookmark-extensions bookmark pp init-helm-thierry helm-mode helm-files org ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete org-list org-faces org-compat org-entities org-macs noutline outline cal-menu calendar cal-loaddefs image-dired tramp tramp-compat format-spec tramp-loaddefs dired-aux ffap thingatpt helm-tags helm-bookmark helm-adaptative helm-info helm-net browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-util url-parse url-vars mailcap helm-plugin helm-locate helm-help helm-match-plugin helm-grep helm-buffers rx helm-elscreen helm-regexp grep helm-external helm-utils helm-descbinds helm helm-ipython ipython python-mode info-look compile executable shell pcomplete comint ansi-color ring helm-delicious xml helm-mercurial xhg xhg-annotate xhg-mq xhg-log xhg-core dvc-diff uniquify warnings dvc-fileinfo dvc-unified dvc-tips diff-mode dvc-core dvc-lisp dvc-buffers dvc-ui dvc-register dvc-utils dvc-emacs ewoc dvc-defs dvc-site dired-x dired regexp-opt helm-config edmacro kmacro epa-file epa derived epg epg-config auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util time-date mm-util mail-prsvr password-cache usage-memo eev-thierry iterator eev-all eev-mini-steps eev-browse-url eev-langs eev-compose eev-glyphs disp-table eev-insert eev-steps eev-bounded eev easy-mmode advice help-fns advice-preload cl w3m-wget info easymenu tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty emacs) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=--