Now on revision 108060. ------------------------------------------------------------ revno: 108060 fixes bug(s): http://debbugs.gnu.org/8390 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-04-29 09:48:23 +0800 message: Fix Follow mode's calculation of window ends. * lisp/follow.el (follow-calc-win-end): Rewrite to handle partial screen lines correctly. (follow-avoid-tail-recenter): Minor cleanup. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-28 21:59:08 +0000 +++ lisp/ChangeLog 2012-04-29 01:48:23 +0000 @@ -1,3 +1,9 @@ +2012-04-29 Chong Yidong + + * follow.el (follow-calc-win-end): Rewrite to handle partial + screen lines correctly (Bug#8390). + (follow-avoid-tail-recenter): Minor cleanup. + 2012-04-28 Stefan Monnier Avoid the obsolete `assoc' package. === modified file 'lisp/follow.el' --- lisp/follow.el 2012-04-09 13:05:48 +0000 +++ lisp/follow.el 2012-04-29 01:48:23 +0000 @@ -24,8 +24,6 @@ ;;; Commentary: -;;{{{ Documentation - ;; `Follow mode' is a minor mode for Emacs and XEmacs that ;; combines windows into one tall virtual window. ;; @@ -220,11 +218,9 @@ ;; non-selected window unaligned. It will, however, pop right back ;; when it is selected.) -;;}}} - ;;; Code: -;;{{{ Preliminaries +;; Preliminaries ;; Make the compiler shut up! ;; There are two strategies: @@ -266,8 +262,7 @@ 'byte-compile-obsolete) (put 'frame-first-window 'byte-compile 'nil)))))) -;;}}} -;;{{{ Variables +;;; Variables (defgroup follow nil "Synchronize windows showing the same buffer." @@ -286,7 +281,7 @@ :group 'follow) (make-obsolete-variable 'follow-mode-off-hook 'follow-mode-hook "22.2") -;;{{{ Keymap/Menu +;;; Keymap/Menu ;; Define keys for the follow-mode minor mode map and replace some ;; functions in the global map. All `follow' mode special functions @@ -373,8 +368,6 @@ "--" ["Follow mode" follow-mode :style toggle :selected follow-mode])) -;;}}} - (defcustom follow-mode-line-text " Follow" "Text shown in the mode line when Follow mode is active. Defaults to \" Follow\". Examples of other values @@ -448,8 +441,7 @@ (defvar follow-windows-start-end-cache nil "Cache used by `follow-window-start-end'.") -;;}}} -;;{{{ Debug messages +;;; Debug messages ;; This inline function must be as small as possible! ;; Maybe we should define a macro that expands to nil if @@ -460,15 +452,12 @@ (if (and (boundp 'follow-debug) follow-debug) (apply 'message args))) -;;}}} -;;{{{ Cache +;;; Cache (dolist (cmd follow-cache-command-list) (put cmd 'follow-mode-use-cache t)) -;;}}} - -;;{{{ The mode +;;; The mode ;;;###autoload (defun turn-on-follow-mode () @@ -536,8 +525,7 @@ ((not follow-mode) ; Off (force-mode-line-update)))) -;;}}} -;;{{{ Find file hook +;;; Find file hook ;; This will start follow-mode whenever a new file is loaded, if ;; the variable `follow-auto' is non-nil. @@ -548,15 +536,9 @@ "Find-file hook for Follow mode. See the variable `follow-auto'." (if follow-auto (follow-mode t))) -;;}}} - -;;{{{ User functions - -;;; -;;; User functions usable when in Follow mode. -;;; - -;;{{{ Scroll +;;; User functions + +;;; Scroll ;; `scroll-up' and `-down', but for windows in Follow mode. ;; @@ -633,8 +615,7 @@ (vertical-motion (- next-screen-context-lines 1)) (setq follow-internal-force-redisplay t)))))) -;;}}} -;;{{{ Buffer +;;; Buffer ;;;###autoload (defun follow-delete-other-windows-and-split (&optional arg) @@ -709,8 +690,7 @@ (follow-mode 1)) (follow-switch-to-buffer-all)) -;;}}} -;;{{{ Movement +;;; Movement ;; Note, these functions are not very useful, at least not unless you ;; rebind the rather cumbersome key sequence `C-c . p'. @@ -744,8 +724,7 @@ (interactive) (select-window (car (reverse (follow-all-followers))))) -;;}}} -;;{{{ Redraw +;;; Redraw (defun follow-recenter (&optional arg) "Recenter the middle window around point. @@ -792,8 +771,7 @@ (sit-for 0) (follow-redisplay)) -;;}}} -;;{{{ End of buffer +;;; End of buffer (defun follow-end-of-buffer (&optional arg) "Move point to the end of the buffer, Follow mode style. @@ -816,15 +794,7 @@ (with-no-warnings (end-of-buffer arg)))) -;;}}} - -;;}}} - -;;{{{ Display - -;;;; The display routines - -;;{{{ Information gathering functions +;;; Display (defun follow-all-followers (&optional testwin) "Return all windows displaying the same buffer as the TESTWIN. @@ -859,46 +829,21 @@ (cons pred (cdr windows)))) -;; This function is optimized function for speed! - (defun follow-calc-win-end (&optional win) - "Calculate the presumed window end for WIN. - -Actually, the position returned is the start of the next -window, normally is the end plus one. - -If WIN is nil, the selected window is used. - -Returns (end-pos end-of-buffer-p)" - (if (featurep 'xemacs) - ;; XEmacs can calculate the end of the window by using - ;; the 'guarantee options. GOOD! - (let ((end (window-end win t))) - (if (= end (point-max (window-buffer win))) - (list end t) - (list (+ end 1) nil))) - ;; Emacs: We have to calculate the end by ourselves. - ;; This code works on both XEmacs and Emacs, but now - ;; that XEmacs has got custom-written code, this could - ;; be optimized for Emacs. - (let (height buffer-end-p) - (with-selected-window (or win (selected-window)) - (save-excursion - (goto-char (window-start)) - (setq height - (- (window-height) - (if header-line-format 2 1))) - (setq buffer-end-p - (if (bolp) - (not (= height (vertical-motion height))) - (save-restriction - ;; Fix a mis-feature in `vertical-motion': - ;; The start of the window is assumed to - ;; coincide with the start of a line. - (narrow-to-region (point) (point-max)) - (not (= height (vertical-motion height)))))) - (list (point) buffer-end-p)))))) - + "Calculate the end position for window WIN. +Return (END-POS END-OF-BUFFER). + +Actually, the position returned is the start of the line after +the last fully-visible line in WIN. If WIN is nil, the selected +window is used." + (let* ((win (or win (selected-window))) + (edges (window-inside-pixel-edges win)) + (ht (- (nth 3 edges) (nth 1 edges))) + (last-line-pos (posn-point (posn-at-x-y 0 (1- ht) win)))) + (if (pos-visible-in-window-p last-line-pos win) + (let ((end (window-end win t))) + (list end (= end (point-max)))) + (list last-line-pos nil)))) ;; Can't use `save-window-excursion' since it triggers a redraw. (defun follow-calc-win-start (windows pos win) @@ -1023,8 +968,7 @@ (vertical-motion 1 win) (set-window-start win (point) 'noforce))))) -;;}}} -;;{{{ Selection functions +;;; Selection functions ;; Make a window in WINDOWS selected if it currently ;; is displaying the position DEST. @@ -1112,8 +1056,8 @@ (set-window-start (car windows) (point) 'noforce) (setq end-pos-end-p (follow-calc-win-end (car windows))) (goto-char (car end-pos-end-p)) - ;; Visible, if dest above end, or if eob is visible inside - ;; the window. + ;; Visible, if dest above end, or if eob is visible + ;; inside the window. (if (or (car (cdr end-pos-end-p)) (< dest (point))) (setq win (car windows)) @@ -1124,9 +1068,7 @@ (goto-char dest)) win)) - -;;}}} -;;{{{ Redisplay +;;; Redisplay ;; Redraw all the windows on the screen, starting with the top window. ;; The window used as as marker is WIN, or the selected window if WIN @@ -1240,8 +1182,7 @@ (setq res (point)))))) res))) -;;}}} -;;{{{ Avoid tail recenter +;;; Avoid tail recenter ;; This sets the window internal flag `force_start'. The effect is that ;; windows only displaying the tail aren't recentered. @@ -1253,12 +1194,6 @@ ;; window-start position is equal to (point-max) of the buffer it ;; displays. ;; -;; This function is also added to `post-command-idle-hook', introduced -;; in Emacs 19.30. This is needed since the vaccine injected by the -;; call from `post-command-hook' only works until the next redisplay. -;; It is possible that the functions in the `post-command-idle-hook' -;; can cause a redisplay, and hence a new vaccine is needed. -;; ;; Sometimes, calling this function could actually cause a redisplay, ;; especially if it is placed in the debug filter section. I must ;; investigate this further... @@ -1270,35 +1205,27 @@ non-first windows in Follow mode." (if follow-avoid-tail-recenter-p (let* ((orig-buffer (current-buffer)) - (top (frame-first-window (selected-frame))) - (win top) - (who '()) ; list of (buffer . frame) - start - pair) ; (buffer . frame) + (top (frame-first-window (selected-frame))) + (win top) + who) ; list of (buffer . frame) ;; If the only window in the frame is a minibuffer ;; window, `next-window' will never find it again... - (if (window-minibuffer-p top) - nil + (unless (window-minibuffer-p top) (while ;; look, no body! - (progn - (setq start (window-start win)) + (let ((start (window-start win)) + (pair (cons (window-buffer win) (window-frame win)))) (set-buffer (window-buffer win)) - (setq pair (cons (window-buffer win) (window-frame win))) - (if (member pair who) - (if (and (boundp 'follow-mode) follow-mode - (eq (point-max) start)) - ;; Write the same window start back, but don't - ;; set the NOFORCE flag. - (set-window-start win start)) - (setq who (cons pair who))) + (cond ((null (member pair who)) + (setq who (cons pair who))) + ((and follow-mode (eq (point-max) start)) + ;; Write the same window start back, but don't + ;; set the NOFORCE flag. + (set-window-start win start))) (setq win (next-window win 'not t)) (not (eq win top)))) ;; Loop while this is true. (set-buffer orig-buffer))))) -;;}}} - -;;}}} -;;{{{ Post Command Hook +;;; Post Command Hook ;; The magic little box. This function is called after every command. @@ -1460,8 +1387,7 @@ ;; recenter them. (follow-avoid-tail-recenter))))) -;;}}} -;;{{{ The region +;;; The region ;; Tries to make the highlighted area representing the region look ;; good when spanning several windows. @@ -1484,8 +1410,7 @@ (set-window-point (car succ) (nth 1 (assq (car succ) win-start-end))) (setq succ (cdr succ))))) -;;}}} -;;{{{ Scroll bar +;;; Scroll bar ;;;; Scroll-bar support code. @@ -1602,8 +1527,7 @@ (select-window orig-win))))) (error nil))))) -;;}}} -;;{{{ Process output +;;; Process output ;; The following sections installs a spy that listens to process ;; output and tries to reposition the windows whose buffers are in @@ -1629,7 +1553,7 @@ ;; Discussion: Should we also advice `process-filter' to make our ;; filter invisible to others? -;;{{{ Advice for `set-process-filter' +;;; Advice for `set-process-filter' ;; Do not call this with 'follow-generic-filter as the name of the ;; filter... @@ -1700,8 +1624,7 @@ (setq alist (cdr alist))) (setq follow-process-filter-alist new))) -;;}}} -;;{{{ Start/stop interception of processes. +;;; Start/stop interception of processes. ;; Normally, all new processes are intercepted by our `set-process-filter'. ;; This is needed to intercept old processes that were started before we were @@ -1747,8 +1670,7 @@ follow-process-filter-alist)))) (setq follow-intercept-processes nil)) -;;}}} -;;{{{ The filter +;;; The filter ;; The following section is a naive method to make buffers with ;; process output to work with Follow mode. Whenever the start of the @@ -1889,10 +1811,7 @@ (not (input-pending-p))) (sit-for 0))) -;;}}} - -;;}}} -;;{{{ Window size change +;;; Window size change ;; In Emacs 19.29, the functions in `window-size-change-functions' are ;; called every time a window in a frame changes size. Most notably, it @@ -1954,9 +1873,7 @@ (set-buffer orig-buffer) (select-window orig-window))))) -;;}}} - -;;{{{ XEmacs isearch +;;; XEmacs isearch ;; In XEmacs, isearch often finds matches in other windows than the ;; currently selected. However, when exiting the old window @@ -1981,8 +1898,7 @@ (current-window-configuration)) (set-buffer buf))))) -;;}}} -;;{{{ Tail window handling +;;; Tail window handling ;; In Emacs (not XEmacs) windows showing nothing are sometimes ;; recentered. When in Follow mode, this is not desirable for @@ -2002,10 +1918,6 @@ ;; By patching `sit-for' we can make sure that to catch all explicit ;; updates initiated by lisp programs. Internal calls, on the other ;; hand, are not handled. -;; -;; Please note that the function `follow-avoid-tail-recenter' is also -;; called from other places, e.g. `post-command-hook' and -;; `post-command-idle-hook'. ;; If this function is called it is too late for this window, but ;; we might save other windows from being recentered. @@ -2037,8 +1949,7 @@ This prevents `mouse-drag-region' from messing things up." (follow-avoid-tail-recenter))) -;;}}} -;;{{{ profile support +;;; Profile support ;; The following (non-evaluated) section can be used to ;; profile this package using `elp'. @@ -2071,9 +1982,7 @@ follow-post-command-hook )))) -;;}}} - -;;{{{ The end +;;; The end (defun follow-unload-function () "Unload Follow mode library." @@ -2106,14 +2015,8 @@ ;; continue standard processing nil) -;; -;; We're done! -;; - (provide 'follow) -;;}}} - ;; /------------------------------------------------------------------------\ ;; | "I [..] am rarely happier then when spending an entire day programming | ;; | my computer to perform automatically a task that it would otherwise | ------------------------------------------------------------ revno: 108059 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-04-28 15:17:27 -0700 message: Do not avoid creating empty evaporating overlays (Bug#9642). * buffer.c (Fmove_overlay): Revert the change of 2012-04-23. That is, do not delete an evaporating overlay if it becomes empty after its bounds are adjusted to fit within its buffer. This fix caused other problems, and I'm reverting it until we get to the bottom of them. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-04-27 03:10:38 +0000 +++ src/ChangeLog 2012-04-28 22:17:27 +0000 @@ -1,3 +1,12 @@ +2012-04-28 Paul Eggert + + Do not avoid creating empty evaporating overlays (Bug#9642). + * buffer.c (Fmove_overlay): Revert the change of 2012-04-23. + That is, do not delete an evaporating overlay if it becomes + empty after its bounds are adjusted to fit within its buffer. + This fix caused other problems, and I'm reverting it until we get + to the bottom of them. + 2012-04-27 Chong Yidong * xselect.c (x_convert_selection): Initialize a pointer (Bug#11315). === modified file 'src/buffer.c' --- src/buffer.c 2012-04-23 22:46:35 +0000 +++ src/buffer.c 2012-04-28 22:17:27 +0000 @@ -3682,7 +3682,6 @@ struct buffer *b, *ob; Lisp_Object obuffer; int count = SPECPDL_INDEX (); - ptrdiff_t n_beg, n_end; CHECK_OVERLAY (overlay); if (NILP (buffer)) @@ -3701,23 +3700,15 @@ CHECK_NUMBER_COERCE_MARKER (beg); CHECK_NUMBER_COERCE_MARKER (end); - if (XINT (beg) > XINT (end)) - { - Lisp_Object temp; - temp = beg; beg = end; end = temp; - } - - /* First set the overlay boundaries, which may clip them. */ - Fset_marker (OVERLAY_START (overlay), beg, buffer); - Fset_marker (OVERLAY_END (overlay), end, buffer); - n_beg = marker_position (OVERLAY_START (overlay)); - n_end = marker_position (OVERLAY_END (overlay)); - - /* Now, delete the overlay if it is empty after clipping and has the - evaporate property. */ - if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate))) + if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate))) return Fdelete_overlay (overlay); + if (XINT (beg) > XINT (end)) + { + Lisp_Object temp; + temp = beg; beg = end; end = temp; + } + specbind (Qinhibit_quit, Qt); obuffer = Fmarker_buffer (OVERLAY_START (overlay)); @@ -3740,7 +3731,7 @@ } /* Redisplay where the overlay is going to be. */ - modify_overlay (b, n_beg, n_end); + modify_overlay (b, XINT (beg), XINT (end)); } else /* Redisplay the area the overlay has just left, or just enclosed. */ @@ -3750,12 +3741,16 @@ o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); - if (o_beg == n_beg) - modify_overlay (b, o_end, n_end); - else if (o_end == n_end) - modify_overlay (b, o_beg, n_beg); + if (o_beg == XINT (beg)) + modify_overlay (b, o_end, XINT (end)); + else if (o_end == XINT (end)) + modify_overlay (b, o_beg, XINT (beg)); else - modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end)); + { + if (XINT (beg) < o_beg) o_beg = XINT (beg); + if (XINT (end) > o_end) o_end = XINT (end); + modify_overlay (b, o_beg, o_end); + } } if (!NILP (obuffer)) @@ -3767,8 +3762,12 @@ eassert (XOVERLAY (overlay)->next == NULL); } + Fset_marker (OVERLAY_START (overlay), beg, buffer); + Fset_marker (OVERLAY_END (overlay), end, buffer); + /* Put the overlay on the wrong list. */ - if (n_end < b->overlay_center) + end = OVERLAY_END (overlay); + if (OVERLAY_POSITION (end) < b->overlay_center) { XOVERLAY (overlay)->next = b->overlays_after; b->overlays_after = XOVERLAY (overlay); ------------------------------------------------------------ revno: 108058 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2012-04-28 17:59:08 -0400 message: Avoid the obsolete `assoc' package. * lisp/speedbar.el (speedbar-refresh): Avoid adelete. (speedbar-file-lists): Simplify and avoid aput. * lisp/man.el (Man--sections, Man--refpages): New vars, replacing Man-sections-alist and Man-refpages-alist. (Man-build-section-alist, Man-build-references-alist): Use them; avoid aput. (Man--last-section, Man--last-refpage): New vars. (Man-follow-manual-reference): Use them. Use the `default' arg of completing-read. (Man-goto-section): Idem. Move prompt to the `interactive' spec. * lisp/gnus/auth-source.el (auth-source--aput-1, auth-source--aput) (auth-source--aget): New functions and macros. Use them instead of aput/aget. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-27 14:16:02 +0000 +++ lisp/ChangeLog 2012-04-28 21:59:08 +0000 @@ -1,3 +1,17 @@ +2012-04-28 Stefan Monnier + + Avoid the obsolete `assoc' package. + * speedbar.el (speedbar-refresh): Avoid adelete. + (speedbar-file-lists): Simplify and avoid aput. + * man.el (Man--sections, Man--refpages): New vars, replacing + Man-sections-alist and Man-refpages-alist. + (Man-build-section-alist, Man-build-references-alist): + Use them; avoid aput. + (Man--last-section, Man--last-refpage): New vars. + (Man-follow-manual-reference): Use them. + Use the `default' arg of completing-read. + (Man-goto-section): Idem. Move prompt to the `interactive' spec. + 2012-04-27 Chong Yidong * vc/diff.el (diff-sentinel): Go to bob (Bug#10259). === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-04-27 03:10:38 +0000 +++ lisp/gnus/ChangeLog 2012-04-28 21:59:08 +0000 @@ -1,3 +1,9 @@ +2012-04-28 Stefan Monnier + + * auth-source.el (auth-source--aput-1, auth-source--aput) + (auth-source--aget): New functions and macros. + Use them instead of aput/aget. + 2012-04-27 Andreas Schwab * gnus.el (debbugs-gnu): Don't override existing autoload definition. === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2012-03-23 11:22:21 +0000 +++ lisp/gnus/auth-source.el 2012-04-28 21:59:08 +0000 @@ -42,7 +42,6 @@ (require 'password-cache) (require 'mm-util) (require 'gnus-util) -(require 'assoc) (eval-when-compile (require 'cl)) (require 'eieio) @@ -853,6 +852,21 @@ ;;; Backend specific parsing: netrc/authinfo backend +(defun auth-source--aput-1 (alist key val) + (let ((seen ()) + (rest alist)) + (while (and (consp rest) (not (equal key (caar rest)))) + (push (pop rest) seen)) + (cons (cons key val) + (if (null rest) alist + (nconc (nreverse seen) + (if (equal key (caar rest)) (cdr rest) rest)))))) +(defmacro auth-source--aput (var key val) + `(setq ,var (auth-source--aput-1 ,var ,key ,val))) + +(defun auth-source--aget (alist key) + (cdr (assoc key alist))) + ;;; (auth-source-netrc-parse "~/.authinfo.gpg") (defun* auth-source-netrc-parse (&rest spec @@ -888,10 +902,11 @@ ;; cache all netrc files (used to be just .gpg files) ;; Store the contents of the file heavily encrypted in memory. ;; (note for the irony-impaired: they are just obfuscated) - (aput 'auth-source-netrc-cache file - (list :mtime (nth 5 (file-attributes file)) - :secret (lexical-let ((v (mapcar '1+ (buffer-string)))) - (lambda () (apply 'string (mapcar '1- v))))))) + (auth-source--aput + auth-source-netrc-cache file + (list :mtime (nth 5 (file-attributes file)) + :secret (lexical-let ((v (mapcar '1+ (buffer-string)))) + (lambda () (apply 'string (mapcar '1- v))))))) (goto-char (point-min)) ;; Go through the file, line by line. (while (and (not (eobp)) @@ -937,21 +952,21 @@ (auth-source-search-collection host (or - (aget alist "machine") - (aget alist "host") + (auth-source--aget alist "machine") + (auth-source--aget alist "host") t)) (auth-source-search-collection user (or - (aget alist "login") - (aget alist "account") - (aget alist "user") + (auth-source--aget alist "login") + (auth-source--aget alist "account") + (auth-source--aget alist "user") t)) (auth-source-search-collection port (or - (aget alist "port") - (aget alist "protocol") + (auth-source--aget alist "port") + (auth-source--aget alist "protocol") t)) (or ;; the required list of keys is nil, or @@ -1166,7 +1181,7 @@ ;; just the value otherwise (t (symbol-value br))))) (when br-choice - (aput 'valist br br-choice))))) + (auth-source--aput valist br br-choice))))) ;; for extra required elements, see if the spec includes a value for them (dolist (er create-extra) @@ -1175,17 +1190,18 @@ collect (nth i spec)))) (dolist (k keys) (when (equal (symbol-name k) name) - (aput 'valist er (plist-get spec k)))))) + (auth-source--aput valist er (plist-get spec k)))))) ;; for each required element (dolist (r required) - (let* ((data (aget valist r)) + (let* ((data (auth-source--aget valist r)) ;; take the first element if the data is a list (data (or (auth-source-netrc-element-or-first data) (plist-get current-data (intern (format ":%s" r) obarray)))) ;; this is the default to be offered - (given-default (aget auth-source-creation-defaults r)) + (given-default (auth-source--aget + auth-source-creation-defaults r)) ;; the default supplementals are simple: ;; for the user, try `given-default' and then (user-login-name); ;; otherwise take `given-default' @@ -1197,22 +1213,22 @@ (cons 'user (or (auth-source-netrc-element-or-first - (aget valist 'user)) + (auth-source--aget valist 'user)) (plist-get artificial :user) "[any user]")) (cons 'host (or (auth-source-netrc-element-or-first - (aget valist 'host)) + (auth-source--aget valist 'host)) (plist-get artificial :host) "[any host]")) (cons 'port (or (auth-source-netrc-element-or-first - (aget valist 'port)) + (auth-source--aget valist 'port)) (plist-get artificial :port) "[any port]")))) - (prompt (or (aget auth-source-creation-prompts r) + (prompt (or (auth-source--aget auth-source-creation-prompts r) (case r (secret "%p password for %u@%h: ") (user "%p user name for %h: ") @@ -1221,9 +1237,9 @@ (format "Enter %s (%%u@%%h:%%p): " r))) (prompt (auth-source-format-prompt prompt - `((?u ,(aget printable-defaults 'user)) - (?h ,(aget printable-defaults 'host)) - (?p ,(aget printable-defaults 'port)))))) + `((?u ,(auth-source--aget printable-defaults 'user)) + (?h ,(auth-source--aget printable-defaults 'host)) + (?p ,(auth-source--aget printable-defaults 'port)))))) ;; Store the data, prompting for the password if needed. (setq data (or data @@ -1384,7 +1400,7 @@ file) (message "Saved new authentication information to %s" file) nil)))) - (aput 'auth-source-netrc-cache key "ran")))) + (auth-source--aput auth-source-netrc-cache key "ran")))) ;;; Backend specific parsing: Secrets API backend @@ -1609,7 +1625,7 @@ ;; just the value otherwise (t (symbol-value br))))) (when br-choice - (aput 'valist br br-choice))))) + (auth-source--aput valist br br-choice))))) ;; for extra required elements, see if the spec includes a value for them (dolist (er create-extra) @@ -1618,17 +1634,18 @@ collect (nth i spec)))) (dolist (k keys) (when (equal (symbol-name k) name) - (aput 'valist er (plist-get spec k)))))) + (auth-source--aput valist er (plist-get spec k)))))) ;; for each required element (dolist (r required) - (let* ((data (aget valist r)) + (let* ((data (auth-source--aget valist r)) ;; take the first element if the data is a list (data (or (auth-source-netrc-element-or-first data) (plist-get current-data (intern (format ":%s" r) obarray)))) ;; this is the default to be offered - (given-default (aget auth-source-creation-defaults r)) + (given-default (auth-source--aget + auth-source-creation-defaults r)) ;; the default supplementals are simple: ;; for the user, try `given-default' and then (user-login-name); ;; otherwise take `given-default' @@ -1640,22 +1657,22 @@ (cons 'user (or (auth-source-netrc-element-or-first - (aget valist 'user)) + (auth-source--aget valist 'user)) (plist-get artificial :user) "[any user]")) (cons 'host (or (auth-source-netrc-element-or-first - (aget valist 'host)) + (auth-source--aget valist 'host)) (plist-get artificial :host) "[any host]")) (cons 'port (or (auth-source-netrc-element-or-first - (aget valist 'port)) + (auth-source--aget valist 'port)) (plist-get artificial :port) "[any port]")))) - (prompt (or (aget auth-source-creation-prompts r) + (prompt (or (auth-source--aget auth-source-creation-prompts r) (case r (secret "%p password for %u@%h: ") (user "%p user name for %h: ") @@ -1664,20 +1681,21 @@ (format "Enter %s (%%u@%%h:%%p): " r))) (prompt (auth-source-format-prompt prompt - `((?u ,(aget printable-defaults 'user)) - (?h ,(aget printable-defaults 'host)) - (?p ,(aget printable-defaults 'port)))))) + `((?u ,(auth-source--aget printable-defaults 'user)) + (?h ,(auth-source--aget printable-defaults 'host)) + (?p ,(auth-source--aget printable-defaults 'port)))))) ;; Store the data, prompting for the password if needed. (setq data (or data (if (eq r 'secret) (or (eval default) (read-passwd prompt)) (if (stringp default) - (read-string (if (string-match ": *\\'" prompt) - (concat (substring prompt 0 (match-beginning 0)) - " (default " default "): ") - (concat prompt "(default " default ") ")) - nil nil default) + (read-string + (if (string-match ": *\\'" prompt) + (concat (substring prompt 0 (match-beginning 0)) + " (default " default "): ") + (concat prompt "(default " default ") ")) + nil nil default) (eval default))))) (when data === modified file 'lisp/man.el' --- lisp/man.el 2012-02-22 08:34:02 +0000 +++ lisp/man.el 2012-04-28 21:59:08 +0000 @@ -89,7 +89,6 @@ ;;; Code: (eval-when-compile (require 'cl)) -(require 'assoc) (require 'button) ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv @@ -360,10 +359,10 @@ (make-variable-buffer-local 'Man-arguments) (put 'Man-arguments 'permanent-local t) -(defvar Man-sections-alist nil) -(make-variable-buffer-local 'Man-sections-alist) -(defvar Man-refpages-alist nil) -(make-variable-buffer-local 'Man-refpages-alist) +(defvar Man--sections nil) +(make-variable-buffer-local 'Man--sections) +(defvar Man--refpages nil) +(make-variable-buffer-local 'Man--refpages) (defvar Man-page-list nil) (make-variable-buffer-local 'Man-page-list) (defvar Man-current-page 0) @@ -1370,17 +1369,19 @@ (run-mode-hooks 'Man-mode-hook)) (defsubst Man-build-section-alist () - "Build the association list of manpage sections." - (setq Man-sections-alist nil) + "Build the list of manpage sections." + (setq Man--sections nil) (goto-char (point-min)) (let ((case-fold-search nil)) (while (re-search-forward Man-heading-regexp (point-max) t) - (aput 'Man-sections-alist (match-string 1)) + (let ((section (match-string 1))) + (unless (member section Man--sections) + (push section Man--sections))) (forward-line 1)))) (defsubst Man-build-references-alist () - "Build the association list of references (in the SEE ALSO section)." - (setq Man-refpages-alist nil) + "Build the list of references (in the SEE ALSO section)." + (setq Man--refpages nil) (save-excursion (if (Man-find-section Man-see-also-regexp) (let ((start (progn (forward-line 1) (point))) @@ -1406,10 +1407,11 @@ len (1- (length word)))) (if (memq (aref word len) '(?- ?­)) (setq hyphenated (substring word 0 len))) - (if (string-match Man-reference-regexp word) - (aput 'Man-refpages-alist word)))) + (and (string-match Man-reference-regexp word) + (not (member word Man--refpages)) + (push word Man--refpages)))) (skip-chars-forward " \t\n,")))))) - (setq Man-refpages-alist (nreverse Man-refpages-alist))) + (setq Man--refpages (nreverse Man--refpages))) (defun Man-build-page-list () "Build the list of separate manpages in the buffer." @@ -1541,21 +1543,22 @@ nil) )) -(defun Man-goto-section () - "Query for section to move point to." - (interactive) - (aput 'Man-sections-alist - (let* ((default (aheadsym Man-sections-alist)) - (completion-ignore-case t) - chosen - (prompt (concat "Go to section (default " default "): "))) - (setq chosen (completing-read prompt Man-sections-alist)) - (if (or (not chosen) - (string= chosen "")) - default - chosen))) - (unless (Man-find-section (aheadsym Man-sections-alist)) - (error "Section not found"))) +(defvar Man--last-section nil) + +(defun Man-goto-section (section) + "Move point to SECTION." + (interactive + (let* ((default (if (member Man--last-section Man--sections) + Man--last-section + (car Man--sections))) + (completion-ignore-case t) + (prompt (concat "Go to section (default " default "): ")) + (chosen (completing-read prompt Man--sections + nil nil nil nil default))) + (list chosen))) + (setq Man--last-section section) + (unless (Man-find-section section) + (error "Section %s not found" section))) (defun Man-goto-see-also-section () @@ -1586,11 +1589,13 @@ (setq word (current-word)))) word))) +(defvar Man--last-refpage nil) + (defun Man-follow-manual-reference (reference) "Get one of the manpages referred to in the \"SEE ALSO\" section. Specify which REFERENCE to use; default is based on word at point." (interactive - (if (not Man-refpages-alist) + (if (not Man--refpages) (error "There are no references in the current man page") (list (let* ((default (or @@ -1603,26 +1608,22 @@ (substring word 0 (match-beginning 0)) word)) - Man-refpages-alist)) - (aheadsym Man-refpages-alist))) + Man--refpages)) + (if (member Man--last-refpage Man--refpages) + Man--last-refpage + (car Man--refpages)))) (defaults (mapcar 'substring-no-properties - (delete-dups - (delq nil (cons default - (mapcar 'car Man-refpages-alist)))))) - chosen - (prompt (concat "Refer to (default " default "): "))) - (setq chosen (completing-read prompt Man-refpages-alist - nil nil nil nil defaults)) - (if (or (not chosen) - (string= chosen "")) - default - chosen))))) - (if (not Man-refpages-alist) + (cons default Man--refpages))) + (prompt (concat "Refer to (default " default "): ")) + (chosen (completing-read prompt Man--refpages + nil nil nil nil defaults))) + chosen)))) + (if (not Man--refpages) (error "Can't find any references in the current manpage") - (aput 'Man-refpages-alist reference) + (setq Man--last-refpage reference) (Man-getpage-in-background - (Man-translate-references (aheadsym Man-refpages-alist))))) + (Man-translate-references reference)))) (defun Man-kill () "Kill the buffer containing the manpage." === modified file 'lisp/speedbar.el' --- lisp/speedbar.el 2012-04-17 00:04:53 +0000 +++ lisp/speedbar.el 2012-04-28 21:59:08 +0000 @@ -125,7 +125,6 @@ ;;; TODO: ;; - Timeout directories we haven't visited in a while. -(require 'assoc) (require 'easymenu) (require 'dframe) (require 'sb-image) @@ -1413,9 +1412,10 @@ (dframe-power-click arg) deactivate-mark) ;; We need to hack something so this works in detached frames. - (while dl - (adelete 'speedbar-directory-contents-alist (car dl)) - (setq dl (cdr dl))) + (dolist (d dl) + (setq speedbar-directory-contents-alist + (delq (assoc d speedbar-directory-contents-alist) + speedbar-directory-contents-alist))) (if (<= 1 speedbar-verbosity-level) (speedbar-message "Refreshing speedbar...")) (speedbar-update-contents) @@ -1898,12 +1898,9 @@ `speedbar-directory-contents-alist' and use that cache before scanning the file-system." (setq directory (expand-file-name directory)) - ;; If in powerclick mode, then the directory we are getting - ;; should be rescanned. - (if dframe-power-click - (adelete 'speedbar-directory-contents-alist directory)) ;; find the directory, either in the cache, or build it. - (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) + (or (and (not dframe-power-click) ;; In powerclick mode, always rescan. + (cdr-safe (assoc directory speedbar-directory-contents-alist))) (let ((default-directory directory) (dir (directory-files directory nil)) (dirs nil) @@ -1917,8 +1914,11 @@ (setq dirs (cons (car dir) dirs)) (setq files (cons (car dir) files)))) (setq dir (cdr dir))) - (let ((nl (cons (nreverse dirs) (list (nreverse files))))) - (aput 'speedbar-directory-contents-alist directory nl) + (let ((nl (cons (nreverse dirs) (list (nreverse files)))) + (ae (assoc directory speedbar-directory-contents-alist))) + (if ae (setcdr ae nl) + (push (cons directory nl) + speedbar-directory-contents-alist)) nl)) )) ------------------------------------------------------------ revno: 108057 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2012-04-28 16:04:34 -0400 message: Add some shell indentation test cases. * test/indent/shell.sh: * test/indent/shell.rc: Add some test cases. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2012-04-24 17:06:12 +0000 +++ test/ChangeLog 2012-04-28 20:04:34 +0000 @@ -1,3 +1,8 @@ +2012-04-28 Stefan Monnier + + * indent/shell.sh: + * indent/shell.rc: Ad some test cases. + 2012-04-24 Stefan Monnier * indent/ruby.rb: New file, to test new syntax-propertize code. === modified file 'test/indent/shell.rc' --- test/indent/shell.rc 2011-02-09 18:59:55 +0000 +++ test/indent/shell.rc 2012-04-28 20:04:34 +0000 @@ -1,7 +1,10 @@ #!/bin/rc if (foo) { - echo 1 + echo 1 \ + toto \ + tutu + titi } if not { echo 2 @@ -23,6 +26,10 @@ for (i in a b c) echo "$i" # KNOWN INDENT BUG echo titi + if (foo) + echo 3 # KNOWN INDENT BUG + if not + echo 4 # KNOWN INDENT BUG case * echo other === modified file 'test/indent/shell.sh' --- test/indent/shell.sh 2011-02-09 18:59:55 +0000 +++ test/indent/shell.sh 2012-04-28 20:04:34 +0000 @@ -13,6 +13,7 @@ case toto in a) hello # KNOWN INDENT BUG ;; b) hi # KNOWN INDENT BUG + ;; c) hi # KNOWN INDENT BUG esac case $toto in @@ -34,7 +35,8 @@ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | - cat # KNOWN INDENT BUG + grep '.' | # KNOWN INDENT BUG + sed 1d case toto in -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ ------------------------------------------------------------ revno: 108056 fixes bug(s): http://debbugs.gnu.org/10259 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-04-27 22:16:02 +0800 message: * lisp/vc/diff.el (diff-sentinel): Go to bob. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-04-27 06:08:14 +0000 +++ lisp/ChangeLog 2012-04-27 14:16:02 +0000 @@ -1,5 +1,7 @@ 2012-04-27 Chong Yidong + * vc/diff.el (diff-sentinel): Go to bob (Bug#10259). + * startup.el (x-apply-session-resources): New function. * term/ns-win.el (ns-initialize-window-system): === modified file 'lisp/vc/diff.el' --- lisp/vc/diff.el 2012-04-26 12:43:28 +0000 +++ lisp/vc/diff.el 2012-04-27 14:16:02 +0000 @@ -67,6 +67,7 @@ (if old-temp-file (delete-file old-temp-file)) (if new-temp-file (delete-file new-temp-file)) (diff-setup-whitespace) + (goto-char (point-min)) (save-excursion (goto-char (point-max)) (let ((inhibit-read-only t))