diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 601949af88e..1b5bdc8fb53 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2013-01-07 Bastien Guerry + + * help.texi (Apropos): Document `apropos-user-option' and update + the doc for `apropos-variable'. + 2013-01-05 Glenn Morris * text.texi (HTML Mode): Remove deleted nxml C-RET binding. diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 0a0a3865d2d..75b250d0f40 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -295,11 +295,16 @@ search for noninteractive functions too. Search for functions and variables. Both interactive functions (commands) and noninteractive functions can be found by this. -@item M-x apropos-variable -@findex apropos-variable +@item M-x apropos-user-option +@findex apropos-user-option Search for user-customizable variables. With a prefix argument, search for non-customizable variables too. +@item M-x apropos-variable +@findex apropos-variable +Search for variables. With a prefix argument, search for +customizable variables only. + @item M-x apropos-value @findex apropos-value Search for variables whose values match the specified pattern. With a diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9425ca5cdc2..185bf74bc05 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,50 @@ +2013-01-07 Bastien Guerry + + * menu-bar.el (menu-bar-search-documentation-menu): Use + `apropos-user-option' and fix the help message. + +2013-01-07 Bastien Guerry + + * apropos.el (apropos-do-all): Update docstring. + (apropos-user-option-button): New face. + (apropos-user-option): Rename from `apropos-variable' and update + docstring. + (apropos-variable): Rewrite, now show all variables by default. + (apropos-print): Mention "User option" instead of "Variable" when + printing doc for user options. (Bug#13276) + +2013-01-07 Jürgen Hötzel + + * net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls): + Handle filename correctly, when parsing "source -> target" symlink + output. + (tramp-adb-handle-set-file-times): New defun. + +2013-01-07 Stefan Monnier + + * emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the + advice list when the interactive-spec of ad-Advice-* changes. + +2013-01-07 Katsumi Yamaoka + + * wid-edit.el (widget-default-get): Work for inlined elements. + (Bug#12670) + +2013-01-07 Michael Albinus + + * net/tramp.el (tramp-default-host-alist): New defcustom. + (tramp-find-host): Use it. + (tramp-eshell-directory-change): Move from tramp-sh.el. Add to + `eshell-directory-change-hook'. + + * net/tramp-adb.el (top): Add adb specific entry in + `tramp-default-host-alist'. + (tramp-adb-file-name-host): Remove function. + (tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection): + Use `tramp-file-name-host' instead of `tramp-adb-file-name-host'. + + * net/tramp-sh.el: Move eshell integration code to tramp.el. + 2013-01-06 Jürgen Hötzel * net/tramp-adb.el (tramp-methods): Add `tramp-tmpdir' entry. @@ -5,9 +52,9 @@ 2013-01-06 Michael Albinus * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can - consist of mor than one digit. - (tramp-adb-file-name-handler-alist): Use - `tramp-handle-file-exists-p' consistently. + consist of more than one digit. + (tramp-adb-file-name-handler-alist): + Use `tramp-handle-file-exists-p' consistently. (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'. (tramp-adb-handle-file-exists-p): Remove function. (tramp-adb-file-name-host): New defun. @@ -141,8 +188,8 @@ (tramp-do-copy-or-rename-file): Ignore errors when calling `set-file-extended-attributes'. - * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add - handler for `file-acl'. + * net/tramp-smb.el (tramp-smb-file-name-handler-alist): + Add handler for `file-acl'. (tramp-smb-handle-file-acl): New defun. 2013-01-02 Jay Belanger diff --git a/lisp/apropos.el b/lisp/apropos.el index 5f481f54e57..000d2d87d05 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -69,7 +69,7 @@ "Non nil means apropos commands will search more extensively. This may be slower. This option affects the following commands: -`apropos-variable' will search all variables, not just user variables. +`apropos-user-option' will search all variables, not just user options. `apropos-command' will also search non-interactive functions. `apropos' will search all symbols, not just functions, variables, faces, and those with property lists. @@ -115,6 +115,12 @@ include key-binding information in its output." :group 'apropos :version "24.3") +(defface apropos-user-option-button + '((t (:inherit (font-lock-variable-name-face button)))) + "Button face indicating a user option in Apropos." + :group 'apropos + :version "24.4") + (defface apropos-misc-button '((t (:inherit (font-lock-constant-face button)))) "Button face indicating a miscellaneous object type in Apropos." @@ -261,6 +267,15 @@ term, and the rest of the words are alternative terms.") 'action (lambda (button) (describe-variable (button-get button 'apropos-symbol)))) +(define-button-type 'apropos-user-option + 'apropos-label "User option" + 'apropos-short-label "o" + 'face 'apropos-user-option-button + 'help-echo "mouse-2, RET: Display more help on this user option" + 'follow-link t + 'action (lambda (button) + (describe-variable (button-get button 'apropos-symbol)))) + (define-button-type 'apropos-face 'apropos-label "Face" 'apropos-short-label "F" @@ -461,15 +476,15 @@ This requires that at least 2 keywords (unless only one was given)." This is used to decide whether to print the result's type or not.") ;;;###autoload -(defun apropos-variable (pattern &optional do-all) - "Show user variables that match PATTERN. +(defun apropos-user-option (pattern &optional do-all) + "Show user options that match PATTERN. PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words. With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show -normal variables." +variables, not just user options." (interactive (list (apropos-read-pattern (if (or current-prefix-arg apropos-do-all) "variable" "user option")) @@ -481,6 +496,17 @@ normal variables." (get symbol 'variable-documentation))) 'custom-variable-p))) +;;;###autoload +(defun apropos-variable (pattern &optional do-not-all) + "Show variables that match PATTERN. +When DO-NOT-ALL is not-nil, show user options only, i.e. behave +like `apropos-user-option'." + (interactive (list (apropos-read-pattern + (if current-prefix-arg "user option" "variable")) + current-prefix-arg)) + (let ((apropos-do-all (if do-not-all nil t))) + (apropos-user-option pattern))) + ;; For auld lang syne: ;;;###autoload (defalias 'command-apropos 'apropos-command) @@ -1099,7 +1125,11 @@ If non-nil TEXT is a string that will be printed as a heading." 'apropos-macro 'apropos-function)) (not nosubst)) - (apropos-print-doc 3 'apropos-variable (not nosubst)) + (apropos-print-doc 3 + (if (custom-variable-p symbol) + 'apropos-user-option + 'apropos-variable) + (not nosubst)) (apropos-print-doc 7 'apropos-group t) (apropos-print-doc 6 'apropos-face t) (apropos-print-doc 5 'apropos-widget t) diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 7917b769ab8..d9d8e4f3b02 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -2917,13 +2917,18 @@ If COMPILE is nil then the result depends on the value of "Redefine FUNCTION with its advised definition from cache or scratch. The resulting FUNCTION will be compiled if `ad-should-compile' returns t. The current definition and its cache-id will be put into the cache." - (let ((verified-cached-definition - (if (ad-verify-cache-id function) - (ad-get-cache-definition function))) - (advicefunname (ad-get-advice-info-field function 'advicefunname))) + (let* ((verified-cached-definition + (if (ad-verify-cache-id function) + (ad-get-cache-definition function))) + (advicefunname (ad-get-advice-info-field function 'advicefunname)) + (old-ispec (interactive-form advicefunname))) (fset advicefunname (or verified-cached-definition (ad-make-advised-definition function))) + (unless (equal (interactive-form advicefunname) old-ispec) + ;; If the interactive-spec of advicefunname has changed, force nadvice to + ;; refresh its copy. + (advice-remove function advicefunname)) (advice-add function :around advicefunname) (if (ad-should-compile function compile) (ad-compile-function function)) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c1140c526f6..40600fc20a9 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,13 @@ +2013-01-07 Daiki Ueno + + * mml-smime.el: Support signing by sender. + Requested by Uwe Brauer. + (mml-smime-sign-with-sender): New user option analogous + to mml2015-sign-with-sender. + (mml-smime-epg-sign): Respect mml-smime-sign-with-sender. + (mml-smime-epg-find-usable-secret-key): New helper function copied from + mml2015.el. + 2012-12-31 Lars Magne Ingebrigtsen * gnus-msg.el (gnus-inews-insert-gcc): Don't insert Gcc headers if Gnus diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 3e769d396b0..e7f9de7980d 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -74,6 +74,11 @@ Whether the passphrase is cached at all is controlled by :group 'mime-security :type '(repeat (string :tag "Key ID"))) +(defcustom mml-smime-sign-with-sender nil + "If t, use message sender so find a key to sign with." + :group 'mime-security + :type 'boolean) + (defun mml-smime-sign (cont) (let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist)))) (if func @@ -366,6 +371,24 @@ Whether the passphrase is cached at all is controlled by (setq pointer (cdr pointer)))) (setq keys (cdr keys))))) +;; XXX: since gpg --list-secret-keys does not return validity of each +;; key, `mml-smime-epg-find-usable-key' defined above is not enough for +;; secret keys. The function `mml-smime-epg-find-usable-secret-key' +;; below looks at appropriate public keys to check usability. +(defun mml-smime-epg-find-usable-secret-key (context name usage) + (let ((secret-keys (epg-list-keys context name t)) + secret-key) + (while (and (not secret-key) secret-keys) + (if (mml-smime-epg-find-usable-key + (epg-list-keys context (epg-sub-key-fingerprint + (car (epg-key-sub-key-list + (car secret-keys))))) + usage) + (setq secret-key (car secret-keys) + secret-keys nil) + (setq secret-keys (cdr secret-keys)))) + secret-key)) + (autoload 'mml-compute-boundary "mml") ;; We require mm-decode, which requires mm-bodies, which autoloads @@ -376,29 +399,36 @@ Whether the passphrase is cached at all is controlled by (let* ((inhibit-redisplay t) (context (epg-make-context 'CMS)) (boundary (mml-compute-boundary cont)) + (sender (message-options-get 'message-sender)) + (signer-names (or mml-smime-signers + (if (and mml-smime-sign-with-sender sender) + (list (concat "<" sender ">"))))) signer-key (signers (or (message-options-get 'mml-smime-epg-signers) (message-options-set - 'mml-smime-epg-signers - (if (eq mm-sign-option 'guided) - (epa-select-keys context "\ + 'mml-smime-epg-signers + (if (eq mm-sign-option 'guided) + (epa-select-keys context "\ Select keys for signing. If no one is selected, default secret key is used. " - mml-smime-signers t) - (if mml-smime-signers - (mapcar - (lambda (signer) - (setq signer-key (mml-smime-epg-find-usable-key - (epg-list-keys context signer t) - 'sign)) - (unless (or signer-key - (y-or-n-p - (format "No secret key for %s; skip it? " + signer-names + t) + (if (or sender mml-smime-signers) + (delq nil + (mapcar + (lambda (signer) + (setq signer-key + (mml-smime-epg-find-usable-secret-key + context signer 'sign)) + (unless (or signer-key + (y-or-n-p + (format + "No secret key for %s; skip it? " signer))) - (error "No secret key for %s" signer)) - signer-key) - mml-smime-signers)))))) + (error "No secret key for %s" signer)) + signer-key) + signer-names))))))) signature micalg) (epg-context-set-signers context signers) (if mml-smime-cache-passphrase diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 024e2237cae..60f2bc2999f 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1637,8 +1637,8 @@ key, a click, or a menu-item")) '(menu-item "Find Options by Value..." apropos-value :help "Find variables whose values match a regexp")) (bindings--define-key menu [find-options-by-name] - '(menu-item "Find Options by Name..." apropos-variable - :help "Find variables whose names match a regexp")) + '(menu-item "Find Options by Name..." apropos-user-option + :help "Find user options whose names match a regexp")) (bindings--define-key menu [find-commands-by-name] '(menu-item "Find Commands by Name..." apropos-command :help "Find commands whose names match a regexp")) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index bb9ff015ac3..f5aadd591d6 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -66,8 +66,12 @@ "[[:space:]]+\\(.*\\)$")) ; \6 filename ;;;###tramp-autoload -(add-to-list 'tramp-methods `(,tramp-adb-method - (tramp-tmpdir "/data/local/tmp"))) +(add-to-list 'tramp-methods + `(,tramp-adb-method + (tramp-tmpdir "/data/local/tmp"))) + +;;;###tramp-autoload +(add-to-list 'tramp-default-host-alist `(,tramp-adb-method nil "")) ;;;###tramp-autoload (eval-after-load 'tramp @@ -119,7 +123,7 @@ (vc-registered . ignore) ;no vc control files on Android devices (write-region . tramp-adb-handle-write-region) (set-file-modes . tramp-adb-handle-set-file-modes) - (set-file-times . ignore) + (set-file-times . tramp-adb-handle-set-file-times) (copy-file . tramp-adb-handle-copy-file) (rename-file . tramp-adb-handle-rename-file) (process-file . tramp-adb-handle-process-file) @@ -307,7 +311,9 @@ pass to the OPERATION." (and is-symlink (cadr (split-string name "\\( -> \\|\n\\)"))))) (push (list - name + (if is-symlink + (car (split-string name "\\( -> \\|\n\\)")) + name) (or is-dir symlink-target) 1 ;link-count ;; no way to handle numeric ids in Androids ash @@ -611,6 +617,19 @@ But handle the case, if the \"test\" command is not available." v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname) "Error while changing file's mode %s" filename))) +(defun tramp-adb-handle-set-file-times (filename &optional time) + "Like `set-file-times' for Tramp files." + (with-parsed-tramp-file-name filename nil + (tramp-flush-file-property v localname) + (let ((time (if (or (null time) (equal time '(0 0))) + (current-time) + time))) + (tramp-adb-command-exit-status + ;; use shell arithmetic because of Emacs integer size limit + v (format "touch -t $(( %d * 65536 + %d )) %s" + (car time) (cadr time) + (tramp-shell-quote-argument localname)))))) + (defun tramp-adb-handle-copy-file (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid preserve-extended-attributes) @@ -937,17 +956,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; Helper functions. -(defun tramp-adb-file-name-host (vec) - "Return host component of VEC. -If it is equal to the default value of `tramp-default-host', `nil' is returned." - (let ((host (tramp-file-name-host vec))) - (unless (equal host (eval (car (get 'tramp-default-host 'standard-value)))) - host))) - (defun tramp-adb-execute-adb-command (vec &rest args) "Returns nil on success error-output on failure." - (when (tramp-adb-file-name-host vec) - (setq args (append (list "-s" (tramp-adb-file-name-host vec)) args))) + (when (> (length (tramp-file-name-host vec)) 0) + (setq args (append (list "-s" (tramp-file-name-host vec)) args))) (with-temp-buffer (prog1 (unless (zerop (apply 'call-process (tramp-adb-program) nil t nil args)) @@ -1048,6 +1060,7 @@ Does not do anything if a connection is already open, but re-opens the connection if a previous connection has died for some reason." (let* ((buf (tramp-get-connection-buffer vec)) (p (get-buffer-process buf)) + (host (tramp-file-name-host vec)) (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) (unless (and p (processp p) (memq (process-status p) '(run open))) @@ -1055,21 +1068,17 @@ connection if a previous connection has died for some reason." (when (and p (processp p)) (delete-process p)) (if (not devices) (tramp-error vec 'file-error "No device connected")) - (if (and (tramp-adb-file-name-host vec) - (not (member (tramp-adb-file-name-host vec) devices))) - (tramp-error - vec 'file-error - "Device %s not connected" (tramp-adb-file-name-host vec))) - (if (and (not (eq (length devices) 1)) - (not (tramp-adb-file-name-host vec))) + (if (and (> (length host) 0) (not (member host devices))) + (tramp-error vec 'file-error "Device %s not connected" host)) + (if (and (> (length devices) 1) (zerop (length host))) (tramp-error vec 'file-error "Multiple Devices connected: No Host/Device specified")) (with-tramp-progress-reporter vec 3 "Opening adb shell connection" (let* ((coding-system-for-read 'utf-8-dos) ;is this correct? (process-connection-type tramp-process-connection-type) - (args (if (tramp-adb-file-name-host vec) - (list "-s" (tramp-adb-file-name-host vec) "shell") + (args (if (> (length host) 0) + (list "-s" host "shell") (list "shell"))) (p (let ((default-directory (tramp-compat-temporary-file-directory))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 79f8d82b02b..d83599a6662 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5181,34 +5181,6 @@ function cell is returned to be applied on a buffer." (t (format "%s <%%s" coding))))))) -;;; Integration of eshell.el: - -(eval-when-compile - (defvar eshell-path-env)) - -;; eshell.el keeps the path in `eshell-path-env'. We must change it -;; when `default-directory' points to another host. -(defun tramp-eshell-directory-change () - "Set `eshell-path-env' to $PATH of the host related to `default-directory'." - (setq eshell-path-env - (if (file-remote-p default-directory) - (with-parsed-tramp-file-name default-directory nil - (mapconcat - 'identity - (tramp-get-remote-path v) - ":")) - (getenv "PATH")))) - -(eval-after-load "esh-util" - '(progn - (tramp-eshell-directory-change) - (add-hook 'eshell-directory-change-hook - 'tramp-eshell-directory-change) - (add-hook 'tramp-unload-hook - (lambda () - (remove-hook 'eshell-directory-change-hook - 'tramp-eshell-directory-change))))) - (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-sh 'force))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7c393622ffc..4c346799dcf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -381,6 +381,22 @@ Useful for su and sudo methods mostly." :group 'tramp :type 'string) +;;;###tramp-autoload +(defcustom tramp-default-host-alist nil + "Default host to use for specific method/user pairs. +This is an alist of items (METHOD USER HOST). The first matching item +specifies the host to use for a file name which does not specify a +host. METHOD and HOST are regular expressions or nil, which is +interpreted as a regular expression which always matches. If no entry +matches, the variable `tramp-default-host' takes effect. + +If the file name does not specify the method, lookup is done using the +empty string for the method name." + :group 'tramp + :type '(repeat (list (choice :tag "Method regexp" regexp sexp) + (choice :tag " User regexp" regexp sexp) + (choice :tag " Host name" string (const nil))))) + (defcustom tramp-default-proxies-alist nil "Route to be followed for specific host/user pairs. This is an alist of items (HOST USER PROXY). The first matching @@ -918,7 +934,7 @@ See `tramp-file-name-structure' for more explanations.") This regexp should match partial Tramp file names only. Please note that the entry in `file-name-handler-alist' is made when -this file (tramp.el) is loaded. This means that this variable must be set +this file \(tramp.el\) is loaded. This means that this variable must be set before loading tramp.el. Alternatively, `file-name-handler-alist' can be updated after changing this variable. @@ -1163,6 +1179,15 @@ This is USER, if non-nil. Otherwise, do a lookup in "Return the right host string to use. This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." (or (and (> (length host) 0) host) + (let ((choices tramp-default-host-alist) + lhost item) + (while choices + (setq item (pop choices)) + (when (and (string-match (or (nth 0 item) "") (or method "")) + (string-match (or (nth 1 item) "") (or user ""))) + (setq lhost (nth 2 item)) + (setq choices nil))) + lhost) tramp-default-host)) (defun tramp-dissect-file-name (name &optional nodefault) @@ -3861,6 +3886,34 @@ Only works for Bourne-like shells." t t result))) result)))) +;;; Integration of eshell.el: + +(eval-when-compile + (defvar eshell-path-env)) + +;; eshell.el keeps the path in `eshell-path-env'. We must change it +;; when `default-directory' points to another host. +(defun tramp-eshell-directory-change () + "Set `eshell-path-env' to $PATH of the host related to `default-directory'." + (setq eshell-path-env + (if (file-remote-p default-directory) + (with-parsed-tramp-file-name default-directory nil + (mapconcat + 'identity + (tramp-get-connection-property v "remote-path" nil) + ":")) + (getenv "PATH")))) + +(eval-after-load "esh-util" + '(progn + (tramp-eshell-directory-change) + (add-hook 'eshell-directory-change-hook + 'tramp-eshell-directory-change) + (add-hook 'tramp-unload-hook + (lambda () + (remove-hook 'eshell-directory-change-hook + 'tramp-eshell-directory-change))))) + ;; Checklist for `tramp-unload-hook' ;; - Unload all `tramp-*' packages ;; - Reset `file-name-handler-alist' diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 5402b0ec204..fb62b039d79 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -526,7 +526,16 @@ Otherwise, just return the value." "Extract the default external value of WIDGET." (widget-apply widget :value-to-external (or (widget-get widget :value) - (widget-apply widget :default-get)))) + (progn + (when (widget-get widget :args) + (let (args) + (dolist (arg (widget-get widget :args)) + (setq args (append args + (if (widget-get arg :inline) + (widget-get arg :args) + (list arg))))) + (widget-put widget :args args))) + (widget-apply widget :default-get))))) (defun widget-match-inline (widget vals) "In WIDGET, match the start of VALS." diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el index bc9135c92d0..238561bef84 100644 --- a/test/automated/advice-tests.el +++ b/test/automated/advice-tests.el @@ -107,6 +107,12 @@ (lambda (f &rest args) (cons (cons 2 (called-interactively-p)) (apply f args)))) (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11))) + + ;; Check handling of interactive spec. + (defun sm-test8 (a) (interactive "p") a) + (defadvice sm-test8 (before adv1 activate) nil) + (defadvice sm-test8 (before adv2 activate) (interactive "P") nil) + (should (equal (interactive-form 'sm-test8) '(interactive "P"))) )) ;; Local Variables: