diff options
| author | Stefan Monnier | 2012-04-28 17:59:08 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-04-28 17:59:08 -0400 |
| commit | 8b6c19f4c23e69f2133a8432d614abdc03bdadc6 (patch) | |
| tree | 50b1ab560ca298e2cf06898ee11b1ed1df1bb000 | |
| parent | 461ef3c5186ce4df67039615b30b84b0c86d7da4 (diff) | |
| download | emacs-8b6c19f4c23e69f2133a8432d614abdc03bdadc6.tar.gz emacs-8b6c19f4c23e69f2133a8432d614abdc03bdadc6.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 98 | ||||
| -rw-r--r-- | lisp/man.el | 91 | ||||
| -rw-r--r-- | lisp/speedbar.el | 22 |
5 files changed, 135 insertions, 96 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eaf07c087a2..13c6c1ecbed 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2012-04-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Avoid the obsolete `assoc' package. | ||
| 4 | * speedbar.el (speedbar-refresh): Avoid adelete. | ||
| 5 | (speedbar-file-lists): Simplify and avoid aput. | ||
| 6 | * man.el (Man--sections, Man--refpages): New vars, replacing | ||
| 7 | Man-sections-alist and Man-refpages-alist. | ||
| 8 | (Man-build-section-alist, Man-build-references-alist): | ||
| 9 | Use them; avoid aput. | ||
| 10 | (Man--last-section, Man--last-refpage): New vars. | ||
| 11 | (Man-follow-manual-reference): Use them. | ||
| 12 | Use the `default' arg of completing-read. | ||
| 13 | (Man-goto-section): Idem. Move prompt to the `interactive' spec. | ||
| 14 | |||
| 1 | 2012-04-27 Chong Yidong <cyd@gnu.org> | 15 | 2012-04-27 Chong Yidong <cyd@gnu.org> |
| 2 | 16 | ||
| 3 | * vc/diff.el (diff-sentinel): Go to bob (Bug#10259). | 17 | * vc/diff.el (diff-sentinel): Go to bob (Bug#10259). |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 556094ca614..cacd20ce99d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-04-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * auth-source.el (auth-source--aput-1, auth-source--aput) | ||
| 4 | (auth-source--aget): New functions and macros. | ||
| 5 | Use them instead of aput/aget. | ||
| 6 | |||
| 1 | 2012-04-27 Andreas Schwab <schwab@linux-m68k.org> | 7 | 2012-04-27 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 8 | ||
| 3 | * gnus.el (debbugs-gnu): Don't override existing autoload definition. | 9 | * gnus.el (debbugs-gnu): Don't override existing autoload definition. |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 34fe5afe7af..d3d213a753b 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -42,7 +42,6 @@ | |||
| 42 | (require 'password-cache) | 42 | (require 'password-cache) |
| 43 | (require 'mm-util) | 43 | (require 'mm-util) |
| 44 | (require 'gnus-util) | 44 | (require 'gnus-util) |
| 45 | (require 'assoc) | ||
| 46 | 45 | ||
| 47 | (eval-when-compile (require 'cl)) | 46 | (eval-when-compile (require 'cl)) |
| 48 | (require 'eieio) | 47 | (require 'eieio) |
| @@ -853,6 +852,21 @@ while \(:host t) would find all host entries." | |||
| 853 | 852 | ||
| 854 | ;;; Backend specific parsing: netrc/authinfo backend | 853 | ;;; Backend specific parsing: netrc/authinfo backend |
| 855 | 854 | ||
| 855 | (defun auth-source--aput-1 (alist key val) | ||
| 856 | (let ((seen ()) | ||
| 857 | (rest alist)) | ||
| 858 | (while (and (consp rest) (not (equal key (caar rest)))) | ||
| 859 | (push (pop rest) seen)) | ||
| 860 | (cons (cons key val) | ||
| 861 | (if (null rest) alist | ||
| 862 | (nconc (nreverse seen) | ||
| 863 | (if (equal key (caar rest)) (cdr rest) rest)))))) | ||
| 864 | (defmacro auth-source--aput (var key val) | ||
| 865 | `(setq ,var (auth-source--aput-1 ,var ,key ,val))) | ||
| 866 | |||
| 867 | (defun auth-source--aget (alist key) | ||
| 868 | (cdr (assoc key alist))) | ||
| 869 | |||
| 856 | ;;; (auth-source-netrc-parse "~/.authinfo.gpg") | 870 | ;;; (auth-source-netrc-parse "~/.authinfo.gpg") |
| 857 | (defun* auth-source-netrc-parse (&rest | 871 | (defun* auth-source-netrc-parse (&rest |
| 858 | spec | 872 | spec |
| @@ -888,10 +902,11 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 888 | ;; cache all netrc files (used to be just .gpg files) | 902 | ;; cache all netrc files (used to be just .gpg files) |
| 889 | ;; Store the contents of the file heavily encrypted in memory. | 903 | ;; Store the contents of the file heavily encrypted in memory. |
| 890 | ;; (note for the irony-impaired: they are just obfuscated) | 904 | ;; (note for the irony-impaired: they are just obfuscated) |
| 891 | (aput 'auth-source-netrc-cache file | 905 | (auth-source--aput |
| 892 | (list :mtime (nth 5 (file-attributes file)) | 906 | auth-source-netrc-cache file |
| 893 | :secret (lexical-let ((v (mapcar '1+ (buffer-string)))) | 907 | (list :mtime (nth 5 (file-attributes file)) |
| 894 | (lambda () (apply 'string (mapcar '1- v))))))) | 908 | :secret (lexical-let ((v (mapcar '1+ (buffer-string)))) |
| 909 | (lambda () (apply 'string (mapcar '1- v))))))) | ||
| 895 | (goto-char (point-min)) | 910 | (goto-char (point-min)) |
| 896 | ;; Go through the file, line by line. | 911 | ;; Go through the file, line by line. |
| 897 | (while (and (not (eobp)) | 912 | (while (and (not (eobp)) |
| @@ -937,21 +952,21 @@ Note that the MAX parameter is used so we can exit the parse early." | |||
| 937 | (auth-source-search-collection | 952 | (auth-source-search-collection |
| 938 | host | 953 | host |
| 939 | (or | 954 | (or |
| 940 | (aget alist "machine") | 955 | (auth-source--aget alist "machine") |
| 941 | (aget alist "host") | 956 | (auth-source--aget alist "host") |
| 942 | t)) | 957 | t)) |
| 943 | (auth-source-search-collection | 958 | (auth-source-search-collection |
| 944 | user | 959 | user |
| 945 | (or | 960 | (or |
| 946 | (aget alist "login") | 961 | (auth-source--aget alist "login") |
| 947 | (aget alist "account") | 962 | (auth-source--aget alist "account") |
| 948 | (aget alist "user") | 963 | (auth-source--aget alist "user") |
| 949 | t)) | 964 | t)) |
| 950 | (auth-source-search-collection | 965 | (auth-source-search-collection |
| 951 | port | 966 | port |
| 952 | (or | 967 | (or |
| 953 | (aget alist "port") | 968 | (auth-source--aget alist "port") |
| 954 | (aget alist "protocol") | 969 | (auth-source--aget alist "protocol") |
| 955 | t)) | 970 | t)) |
| 956 | (or | 971 | (or |
| 957 | ;; the required list of keys is nil, or | 972 | ;; the required list of keys is nil, or |
| @@ -1166,7 +1181,7 @@ See `auth-source-search' for details on SPEC." | |||
| 1166 | ;; just the value otherwise | 1181 | ;; just the value otherwise |
| 1167 | (t (symbol-value br))))) | 1182 | (t (symbol-value br))))) |
| 1168 | (when br-choice | 1183 | (when br-choice |
| 1169 | (aput 'valist br br-choice))))) | 1184 | (auth-source--aput valist br br-choice))))) |
| 1170 | 1185 | ||
| 1171 | ;; for extra required elements, see if the spec includes a value for them | 1186 | ;; for extra required elements, see if the spec includes a value for them |
| 1172 | (dolist (er create-extra) | 1187 | (dolist (er create-extra) |
| @@ -1175,17 +1190,18 @@ See `auth-source-search' for details on SPEC." | |||
| 1175 | collect (nth i spec)))) | 1190 | collect (nth i spec)))) |
| 1176 | (dolist (k keys) | 1191 | (dolist (k keys) |
| 1177 | (when (equal (symbol-name k) name) | 1192 | (when (equal (symbol-name k) name) |
| 1178 | (aput 'valist er (plist-get spec k)))))) | 1193 | (auth-source--aput valist er (plist-get spec k)))))) |
| 1179 | 1194 | ||
| 1180 | ;; for each required element | 1195 | ;; for each required element |
| 1181 | (dolist (r required) | 1196 | (dolist (r required) |
| 1182 | (let* ((data (aget valist r)) | 1197 | (let* ((data (auth-source--aget valist r)) |
| 1183 | ;; take the first element if the data is a list | 1198 | ;; take the first element if the data is a list |
| 1184 | (data (or (auth-source-netrc-element-or-first data) | 1199 | (data (or (auth-source-netrc-element-or-first data) |
| 1185 | (plist-get current-data | 1200 | (plist-get current-data |
| 1186 | (intern (format ":%s" r) obarray)))) | 1201 | (intern (format ":%s" r) obarray)))) |
| 1187 | ;; this is the default to be offered | 1202 | ;; this is the default to be offered |
| 1188 | (given-default (aget auth-source-creation-defaults r)) | 1203 | (given-default (auth-source--aget |
| 1204 | auth-source-creation-defaults r)) | ||
| 1189 | ;; the default supplementals are simple: | 1205 | ;; the default supplementals are simple: |
| 1190 | ;; for the user, try `given-default' and then (user-login-name); | 1206 | ;; for the user, try `given-default' and then (user-login-name); |
| 1191 | ;; otherwise take `given-default' | 1207 | ;; otherwise take `given-default' |
| @@ -1197,22 +1213,22 @@ See `auth-source-search' for details on SPEC." | |||
| 1197 | (cons 'user | 1213 | (cons 'user |
| 1198 | (or | 1214 | (or |
| 1199 | (auth-source-netrc-element-or-first | 1215 | (auth-source-netrc-element-or-first |
| 1200 | (aget valist 'user)) | 1216 | (auth-source--aget valist 'user)) |
| 1201 | (plist-get artificial :user) | 1217 | (plist-get artificial :user) |
| 1202 | "[any user]")) | 1218 | "[any user]")) |
| 1203 | (cons 'host | 1219 | (cons 'host |
| 1204 | (or | 1220 | (or |
| 1205 | (auth-source-netrc-element-or-first | 1221 | (auth-source-netrc-element-or-first |
| 1206 | (aget valist 'host)) | 1222 | (auth-source--aget valist 'host)) |
| 1207 | (plist-get artificial :host) | 1223 | (plist-get artificial :host) |
| 1208 | "[any host]")) | 1224 | "[any host]")) |
| 1209 | (cons 'port | 1225 | (cons 'port |
| 1210 | (or | 1226 | (or |
| 1211 | (auth-source-netrc-element-or-first | 1227 | (auth-source-netrc-element-or-first |
| 1212 | (aget valist 'port)) | 1228 | (auth-source--aget valist 'port)) |
| 1213 | (plist-get artificial :port) | 1229 | (plist-get artificial :port) |
| 1214 | "[any port]")))) | 1230 | "[any port]")))) |
| 1215 | (prompt (or (aget auth-source-creation-prompts r) | 1231 | (prompt (or (auth-source--aget auth-source-creation-prompts r) |
| 1216 | (case r | 1232 | (case r |
| 1217 | (secret "%p password for %u@%h: ") | 1233 | (secret "%p password for %u@%h: ") |
| 1218 | (user "%p user name for %h: ") | 1234 | (user "%p user name for %h: ") |
| @@ -1221,9 +1237,9 @@ See `auth-source-search' for details on SPEC." | |||
| 1221 | (format "Enter %s (%%u@%%h:%%p): " r))) | 1237 | (format "Enter %s (%%u@%%h:%%p): " r))) |
| 1222 | (prompt (auth-source-format-prompt | 1238 | (prompt (auth-source-format-prompt |
| 1223 | prompt | 1239 | prompt |
| 1224 | `((?u ,(aget printable-defaults 'user)) | 1240 | `((?u ,(auth-source--aget printable-defaults 'user)) |
| 1225 | (?h ,(aget printable-defaults 'host)) | 1241 | (?h ,(auth-source--aget printable-defaults 'host)) |
| 1226 | (?p ,(aget printable-defaults 'port)))))) | 1242 | (?p ,(auth-source--aget printable-defaults 'port)))))) |
| 1227 | 1243 | ||
| 1228 | ;; Store the data, prompting for the password if needed. | 1244 | ;; Store the data, prompting for the password if needed. |
| 1229 | (setq data (or data | 1245 | (setq data (or data |
| @@ -1384,7 +1400,7 @@ Respects `auth-source-save-behavior'. Uses | |||
| 1384 | file) | 1400 | file) |
| 1385 | (message "Saved new authentication information to %s" file) | 1401 | (message "Saved new authentication information to %s" file) |
| 1386 | nil)))) | 1402 | nil)))) |
| 1387 | (aput 'auth-source-netrc-cache key "ran")))) | 1403 | (auth-source--aput auth-source-netrc-cache key "ran")))) |
| 1388 | 1404 | ||
| 1389 | ;;; Backend specific parsing: Secrets API backend | 1405 | ;;; Backend specific parsing: Secrets API backend |
| 1390 | 1406 | ||
| @@ -1609,7 +1625,7 @@ authentication tokens: | |||
| 1609 | ;; just the value otherwise | 1625 | ;; just the value otherwise |
| 1610 | (t (symbol-value br))))) | 1626 | (t (symbol-value br))))) |
| 1611 | (when br-choice | 1627 | (when br-choice |
| 1612 | (aput 'valist br br-choice))))) | 1628 | (auth-source--aput valist br br-choice))))) |
| 1613 | 1629 | ||
| 1614 | ;; for extra required elements, see if the spec includes a value for them | 1630 | ;; for extra required elements, see if the spec includes a value for them |
| 1615 | (dolist (er create-extra) | 1631 | (dolist (er create-extra) |
| @@ -1618,17 +1634,18 @@ authentication tokens: | |||
| 1618 | collect (nth i spec)))) | 1634 | collect (nth i spec)))) |
| 1619 | (dolist (k keys) | 1635 | (dolist (k keys) |
| 1620 | (when (equal (symbol-name k) name) | 1636 | (when (equal (symbol-name k) name) |
| 1621 | (aput 'valist er (plist-get spec k)))))) | 1637 | (auth-source--aput valist er (plist-get spec k)))))) |
| 1622 | 1638 | ||
| 1623 | ;; for each required element | 1639 | ;; for each required element |
| 1624 | (dolist (r required) | 1640 | (dolist (r required) |
| 1625 | (let* ((data (aget valist r)) | 1641 | (let* ((data (auth-source--aget valist r)) |
| 1626 | ;; take the first element if the data is a list | 1642 | ;; take the first element if the data is a list |
| 1627 | (data (or (auth-source-netrc-element-or-first data) | 1643 | (data (or (auth-source-netrc-element-or-first data) |
| 1628 | (plist-get current-data | 1644 | (plist-get current-data |
| 1629 | (intern (format ":%s" r) obarray)))) | 1645 | (intern (format ":%s" r) obarray)))) |
| 1630 | ;; this is the default to be offered | 1646 | ;; this is the default to be offered |
| 1631 | (given-default (aget auth-source-creation-defaults r)) | 1647 | (given-default (auth-source--aget |
| 1648 | auth-source-creation-defaults r)) | ||
| 1632 | ;; the default supplementals are simple: | 1649 | ;; the default supplementals are simple: |
| 1633 | ;; for the user, try `given-default' and then (user-login-name); | 1650 | ;; for the user, try `given-default' and then (user-login-name); |
| 1634 | ;; otherwise take `given-default' | 1651 | ;; otherwise take `given-default' |
| @@ -1640,22 +1657,22 @@ authentication tokens: | |||
| 1640 | (cons 'user | 1657 | (cons 'user |
| 1641 | (or | 1658 | (or |
| 1642 | (auth-source-netrc-element-or-first | 1659 | (auth-source-netrc-element-or-first |
| 1643 | (aget valist 'user)) | 1660 | (auth-source--aget valist 'user)) |
| 1644 | (plist-get artificial :user) | 1661 | (plist-get artificial :user) |
| 1645 | "[any user]")) | 1662 | "[any user]")) |
| 1646 | (cons 'host | 1663 | (cons 'host |
| 1647 | (or | 1664 | (or |
| 1648 | (auth-source-netrc-element-or-first | 1665 | (auth-source-netrc-element-or-first |
| 1649 | (aget valist 'host)) | 1666 | (auth-source--aget valist 'host)) |
| 1650 | (plist-get artificial :host) | 1667 | (plist-get artificial :host) |
| 1651 | "[any host]")) | 1668 | "[any host]")) |
| 1652 | (cons 'port | 1669 | (cons 'port |
| 1653 | (or | 1670 | (or |
| 1654 | (auth-source-netrc-element-or-first | 1671 | (auth-source-netrc-element-or-first |
| 1655 | (aget valist 'port)) | 1672 | (auth-source--aget valist 'port)) |
| 1656 | (plist-get artificial :port) | 1673 | (plist-get artificial :port) |
| 1657 | "[any port]")))) | 1674 | "[any port]")))) |
| 1658 | (prompt (or (aget auth-source-creation-prompts r) | 1675 | (prompt (or (auth-source--aget auth-source-creation-prompts r) |
| 1659 | (case r | 1676 | (case r |
| 1660 | (secret "%p password for %u@%h: ") | 1677 | (secret "%p password for %u@%h: ") |
| 1661 | (user "%p user name for %h: ") | 1678 | (user "%p user name for %h: ") |
| @@ -1664,20 +1681,21 @@ authentication tokens: | |||
| 1664 | (format "Enter %s (%%u@%%h:%%p): " r))) | 1681 | (format "Enter %s (%%u@%%h:%%p): " r))) |
| 1665 | (prompt (auth-source-format-prompt | 1682 | (prompt (auth-source-format-prompt |
| 1666 | prompt | 1683 | prompt |
| 1667 | `((?u ,(aget printable-defaults 'user)) | 1684 | `((?u ,(auth-source--aget printable-defaults 'user)) |
| 1668 | (?h ,(aget printable-defaults 'host)) | 1685 | (?h ,(auth-source--aget printable-defaults 'host)) |
| 1669 | (?p ,(aget printable-defaults 'port)))))) | 1686 | (?p ,(auth-source--aget printable-defaults 'port)))))) |
| 1670 | 1687 | ||
| 1671 | ;; Store the data, prompting for the password if needed. | 1688 | ;; Store the data, prompting for the password if needed. |
| 1672 | (setq data (or data | 1689 | (setq data (or data |
| 1673 | (if (eq r 'secret) | 1690 | (if (eq r 'secret) |
| 1674 | (or (eval default) (read-passwd prompt)) | 1691 | (or (eval default) (read-passwd prompt)) |
| 1675 | (if (stringp default) | 1692 | (if (stringp default) |
| 1676 | (read-string (if (string-match ": *\\'" prompt) | 1693 | (read-string |
| 1677 | (concat (substring prompt 0 (match-beginning 0)) | 1694 | (if (string-match ": *\\'" prompt) |
| 1678 | " (default " default "): ") | 1695 | (concat (substring prompt 0 (match-beginning 0)) |
| 1679 | (concat prompt "(default " default ") ")) | 1696 | " (default " default "): ") |
| 1680 | nil nil default) | 1697 | (concat prompt "(default " default ") ")) |
| 1698 | nil nil default) | ||
| 1681 | (eval default))))) | 1699 | (eval default))))) |
| 1682 | 1700 | ||
| 1683 | (when data | 1701 | (when data |
diff --git a/lisp/man.el b/lisp/man.el index 0a7b831ca8e..6912486dffa 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -89,7 +89,6 @@ | |||
| 89 | ;;; Code: | 89 | ;;; Code: |
| 90 | 90 | ||
| 91 | (eval-when-compile (require 'cl)) | 91 | (eval-when-compile (require 'cl)) |
| 92 | (require 'assoc) | ||
| 93 | (require 'button) | 92 | (require 'button) |
| 94 | 93 | ||
| 95 | ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | 94 | ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
| @@ -360,10 +359,10 @@ Otherwise, the value is whatever the function | |||
| 360 | (make-variable-buffer-local 'Man-arguments) | 359 | (make-variable-buffer-local 'Man-arguments) |
| 361 | (put 'Man-arguments 'permanent-local t) | 360 | (put 'Man-arguments 'permanent-local t) |
| 362 | 361 | ||
| 363 | (defvar Man-sections-alist nil) | 362 | (defvar Man--sections nil) |
| 364 | (make-variable-buffer-local 'Man-sections-alist) | 363 | (make-variable-buffer-local 'Man--sections) |
| 365 | (defvar Man-refpages-alist nil) | 364 | (defvar Man--refpages nil) |
| 366 | (make-variable-buffer-local 'Man-refpages-alist) | 365 | (make-variable-buffer-local 'Man--refpages) |
| 367 | (defvar Man-page-list nil) | 366 | (defvar Man-page-list nil) |
| 368 | (make-variable-buffer-local 'Man-page-list) | 367 | (make-variable-buffer-local 'Man-page-list) |
| 369 | (defvar Man-current-page 0) | 368 | (defvar Man-current-page 0) |
| @@ -1370,17 +1369,19 @@ The following key bindings are currently in effect in the buffer: | |||
| 1370 | (run-mode-hooks 'Man-mode-hook)) | 1369 | (run-mode-hooks 'Man-mode-hook)) |
| 1371 | 1370 | ||
| 1372 | (defsubst Man-build-section-alist () | 1371 | (defsubst Man-build-section-alist () |
| 1373 | "Build the association list of manpage sections." | 1372 | "Build the list of manpage sections." |
| 1374 | (setq Man-sections-alist nil) | 1373 | (setq Man--sections nil) |
| 1375 | (goto-char (point-min)) | 1374 | (goto-char (point-min)) |
| 1376 | (let ((case-fold-search nil)) | 1375 | (let ((case-fold-search nil)) |
| 1377 | (while (re-search-forward Man-heading-regexp (point-max) t) | 1376 | (while (re-search-forward Man-heading-regexp (point-max) t) |
| 1378 | (aput 'Man-sections-alist (match-string 1)) | 1377 | (let ((section (match-string 1))) |
| 1378 | (unless (member section Man--sections) | ||
| 1379 | (push section Man--sections))) | ||
| 1379 | (forward-line 1)))) | 1380 | (forward-line 1)))) |
| 1380 | 1381 | ||
| 1381 | (defsubst Man-build-references-alist () | 1382 | (defsubst Man-build-references-alist () |
| 1382 | "Build the association list of references (in the SEE ALSO section)." | 1383 | "Build the list of references (in the SEE ALSO section)." |
| 1383 | (setq Man-refpages-alist nil) | 1384 | (setq Man--refpages nil) |
| 1384 | (save-excursion | 1385 | (save-excursion |
| 1385 | (if (Man-find-section Man-see-also-regexp) | 1386 | (if (Man-find-section Man-see-also-regexp) |
| 1386 | (let ((start (progn (forward-line 1) (point))) | 1387 | (let ((start (progn (forward-line 1) (point))) |
| @@ -1406,10 +1407,11 @@ The following key bindings are currently in effect in the buffer: | |||
| 1406 | len (1- (length word)))) | 1407 | len (1- (length word)))) |
| 1407 | (if (memq (aref word len) '(?- ?)) | 1408 | (if (memq (aref word len) '(?- ?)) |
| 1408 | (setq hyphenated (substring word 0 len))) | 1409 | (setq hyphenated (substring word 0 len))) |
| 1409 | (if (string-match Man-reference-regexp word) | 1410 | (and (string-match Man-reference-regexp word) |
| 1410 | (aput 'Man-refpages-alist word)))) | 1411 | (not (member word Man--refpages)) |
| 1412 | (push word Man--refpages)))) | ||
| 1411 | (skip-chars-forward " \t\n,")))))) | 1413 | (skip-chars-forward " \t\n,")))))) |
| 1412 | (setq Man-refpages-alist (nreverse Man-refpages-alist))) | 1414 | (setq Man--refpages (nreverse Man--refpages))) |
| 1413 | 1415 | ||
| 1414 | (defun Man-build-page-list () | 1416 | (defun Man-build-page-list () |
| 1415 | "Build the list of separate manpages in the buffer." | 1417 | "Build the list of separate manpages in the buffer." |
| @@ -1541,21 +1543,22 @@ Returns t if section is found, nil otherwise." | |||
| 1541 | nil) | 1543 | nil) |
| 1542 | )) | 1544 | )) |
| 1543 | 1545 | ||
| 1544 | (defun Man-goto-section () | 1546 | (defvar Man--last-section nil) |
| 1545 | "Query for section to move point to." | 1547 | |
| 1546 | (interactive) | 1548 | (defun Man-goto-section (section) |
| 1547 | (aput 'Man-sections-alist | 1549 | "Move point to SECTION." |
| 1548 | (let* ((default (aheadsym Man-sections-alist)) | 1550 | (interactive |
| 1549 | (completion-ignore-case t) | 1551 | (let* ((default (if (member Man--last-section Man--sections) |
| 1550 | chosen | 1552 | Man--last-section |
| 1551 | (prompt (concat "Go to section (default " default "): "))) | 1553 | (car Man--sections))) |
| 1552 | (setq chosen (completing-read prompt Man-sections-alist)) | 1554 | (completion-ignore-case t) |
| 1553 | (if (or (not chosen) | 1555 | (prompt (concat "Go to section (default " default "): ")) |
| 1554 | (string= chosen "")) | 1556 | (chosen (completing-read prompt Man--sections |
| 1555 | default | 1557 | nil nil nil nil default))) |
| 1556 | chosen))) | 1558 | (list chosen))) |
| 1557 | (unless (Man-find-section (aheadsym Man-sections-alist)) | 1559 | (setq Man--last-section section) |
| 1558 | (error "Section not found"))) | 1560 | (unless (Man-find-section section) |
| 1561 | (error "Section %s not found" section))) | ||
| 1559 | 1562 | ||
| 1560 | 1563 | ||
| 1561 | (defun Man-goto-see-also-section () | 1564 | (defun Man-goto-see-also-section () |
| @@ -1586,11 +1589,13 @@ as \"tcgetp-grp(3V)\", and point is at \"grp(3V)\", we return | |||
| 1586 | (setq word (current-word)))) | 1589 | (setq word (current-word)))) |
| 1587 | word))) | 1590 | word))) |
| 1588 | 1591 | ||
| 1592 | (defvar Man--last-refpage nil) | ||
| 1593 | |||
| 1589 | (defun Man-follow-manual-reference (reference) | 1594 | (defun Man-follow-manual-reference (reference) |
| 1590 | "Get one of the manpages referred to in the \"SEE ALSO\" section. | 1595 | "Get one of the manpages referred to in the \"SEE ALSO\" section. |
| 1591 | Specify which REFERENCE to use; default is based on word at point." | 1596 | Specify which REFERENCE to use; default is based on word at point." |
| 1592 | (interactive | 1597 | (interactive |
| 1593 | (if (not Man-refpages-alist) | 1598 | (if (not Man--refpages) |
| 1594 | (error "There are no references in the current man page") | 1599 | (error "There are no references in the current man page") |
| 1595 | (list | 1600 | (list |
| 1596 | (let* ((default (or | 1601 | (let* ((default (or |
| @@ -1603,26 +1608,22 @@ Specify which REFERENCE to use; default is based on word at point." | |||
| 1603 | (substring word 0 | 1608 | (substring word 0 |
| 1604 | (match-beginning 0)) | 1609 | (match-beginning 0)) |
| 1605 | word)) | 1610 | word)) |
| 1606 | Man-refpages-alist)) | 1611 | Man--refpages)) |
| 1607 | (aheadsym Man-refpages-alist))) | 1612 | (if (member Man--last-refpage Man--refpages) |
| 1613 | Man--last-refpage | ||
| 1614 | (car Man--refpages)))) | ||
| 1608 | (defaults | 1615 | (defaults |
| 1609 | (mapcar 'substring-no-properties | 1616 | (mapcar 'substring-no-properties |
| 1610 | (delete-dups | 1617 | (cons default Man--refpages))) |
| 1611 | (delq nil (cons default | 1618 | (prompt (concat "Refer to (default " default "): ")) |
| 1612 | (mapcar 'car Man-refpages-alist)))))) | 1619 | (chosen (completing-read prompt Man--refpages |
| 1613 | chosen | 1620 | nil nil nil nil defaults))) |
| 1614 | (prompt (concat "Refer to (default " default "): "))) | 1621 | chosen)))) |
| 1615 | (setq chosen (completing-read prompt Man-refpages-alist | 1622 | (if (not Man--refpages) |
| 1616 | nil nil nil nil defaults)) | ||
| 1617 | (if (or (not chosen) | ||
| 1618 | (string= chosen "")) | ||
| 1619 | default | ||
| 1620 | chosen))))) | ||
| 1621 | (if (not Man-refpages-alist) | ||
| 1622 | (error "Can't find any references in the current manpage") | 1623 | (error "Can't find any references in the current manpage") |
| 1623 | (aput 'Man-refpages-alist reference) | 1624 | (setq Man--last-refpage reference) |
| 1624 | (Man-getpage-in-background | 1625 | (Man-getpage-in-background |
| 1625 | (Man-translate-references (aheadsym Man-refpages-alist))))) | 1626 | (Man-translate-references reference)))) |
| 1626 | 1627 | ||
| 1627 | (defun Man-kill () | 1628 | (defun Man-kill () |
| 1628 | "Kill the buffer containing the manpage." | 1629 | "Kill the buffer containing the manpage." |
diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 9065d9ed131..c1e86e17e37 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el | |||
| @@ -125,7 +125,6 @@ this version is not backward compatible to 0.14 or earlier.") | |||
| 125 | ;;; TODO: | 125 | ;;; TODO: |
| 126 | ;; - Timeout directories we haven't visited in a while. | 126 | ;; - Timeout directories we haven't visited in a while. |
| 127 | 127 | ||
| 128 | (require 'assoc) | ||
| 129 | (require 'easymenu) | 128 | (require 'easymenu) |
| 130 | (require 'dframe) | 129 | (require 'dframe) |
| 131 | (require 'sb-image) | 130 | (require 'sb-image) |
| @@ -1413,9 +1412,10 @@ Argument ARG represents to force a refresh past any caches that may exist." | |||
| 1413 | (dframe-power-click arg) | 1412 | (dframe-power-click arg) |
| 1414 | deactivate-mark) | 1413 | deactivate-mark) |
| 1415 | ;; We need to hack something so this works in detached frames. | 1414 | ;; We need to hack something so this works in detached frames. |
| 1416 | (while dl | 1415 | (dolist (d dl) |
| 1417 | (adelete 'speedbar-directory-contents-alist (car dl)) | 1416 | (setq speedbar-directory-contents-alist |
| 1418 | (setq dl (cdr dl))) | 1417 | (delq (assoc d speedbar-directory-contents-alist) |
| 1418 | speedbar-directory-contents-alist))) | ||
| 1419 | (if (<= 1 speedbar-verbosity-level) | 1419 | (if (<= 1 speedbar-verbosity-level) |
| 1420 | (speedbar-message "Refreshing speedbar...")) | 1420 | (speedbar-message "Refreshing speedbar...")) |
| 1421 | (speedbar-update-contents) | 1421 | (speedbar-update-contents) |
| @@ -1898,12 +1898,9 @@ matching ignored headers. Cache any directory files found in | |||
| 1898 | `speedbar-directory-contents-alist' and use that cache before scanning | 1898 | `speedbar-directory-contents-alist' and use that cache before scanning |
| 1899 | the file-system." | 1899 | the file-system." |
| 1900 | (setq directory (expand-file-name directory)) | 1900 | (setq directory (expand-file-name directory)) |
| 1901 | ;; If in powerclick mode, then the directory we are getting | ||
| 1902 | ;; should be rescanned. | ||
| 1903 | (if dframe-power-click | ||
| 1904 | (adelete 'speedbar-directory-contents-alist directory)) | ||
| 1905 | ;; find the directory, either in the cache, or build it. | 1901 | ;; find the directory, either in the cache, or build it. |
| 1906 | (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) | 1902 | (or (and (not dframe-power-click) ;; In powerclick mode, always rescan. |
| 1903 | (cdr-safe (assoc directory speedbar-directory-contents-alist))) | ||
| 1907 | (let ((default-directory directory) | 1904 | (let ((default-directory directory) |
| 1908 | (dir (directory-files directory nil)) | 1905 | (dir (directory-files directory nil)) |
| 1909 | (dirs nil) | 1906 | (dirs nil) |
| @@ -1917,8 +1914,11 @@ the file-system." | |||
| 1917 | (setq dirs (cons (car dir) dirs)) | 1914 | (setq dirs (cons (car dir) dirs)) |
| 1918 | (setq files (cons (car dir) files)))) | 1915 | (setq files (cons (car dir) files)))) |
| 1919 | (setq dir (cdr dir))) | 1916 | (setq dir (cdr dir))) |
| 1920 | (let ((nl (cons (nreverse dirs) (list (nreverse files))))) | 1917 | (let ((nl (cons (nreverse dirs) (list (nreverse files)))) |
| 1921 | (aput 'speedbar-directory-contents-alist directory nl) | 1918 | (ae (assoc directory speedbar-directory-contents-alist))) |
| 1919 | (if ae (setcdr ae nl) | ||
| 1920 | (push (cons directory nl) | ||
| 1921 | speedbar-directory-contents-alist)) | ||
| 1922 | nl)) | 1922 | nl)) |
| 1923 | )) | 1923 | )) |
| 1924 | 1924 | ||