Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 100550. ------------------------------------------------------------ revno: 100550 committer: Glenn Morris branch nick: trunk timestamp: Tue 2010-06-08 23:53:17 -0700 message: * admin/notes/bugtracker: Note on some emacs-bug-tracker minutiae. diff: === modified file 'admin/notes/bugtracker' --- admin/notes/bugtracker 2010-05-22 17:39:35 +0000 +++ admin/notes/bugtracker 2010-06-09 06:53:17 +0000 @@ -149,6 +149,23 @@ ^X-GNU-PR-Message: (transcript|closed) +** Not receiving messages in response to your control commands? +The messages debbugs sends out in response to control-server commands +always have headers To: your@email, and Cc: tracker@debbugs.gnu.org +(the latter is an alias for the emacs-bug-tracker mailing list). +These are also the addresses to which a copy of the response is sent. +(In general, there need not be any relation between the To: and Cc: +headers visible in a message and where debbugs actually sends it.) +If you used an X-Debbugs-No-Ack header, however, a copy is _not_ sent +to you, but the To: header is unchanged. If you are subscribed to the +emacs-bug-tracker mailing list and have duplicate suppression turned +on, the presence of your address in the To: header will cause Mailman +to not send you a list copy, because it thinks you have received a +direct copy. If you used X-Debbugs-No-Ack, this is not the case, and +you won't get any copy at all. If this bothers you, don't use both +X-Debbugs-No-Ack and Mailman duplicate suppression for the +emacs-bug-tracker mailing list, just pick one or the other. + ** How to avoid multiple copies of mails. If you reply to reports in the normal way, this should work fine. Basically, reply only to the numbered bug address (and any individual ------------------------------------------------------------ revno: 100549 committer: Dan Nicolaescu branch nick: trunk timestamp: Tue 2010-06-08 23:48:29 -0700 message: Add optional support for resetting VC properties. * lisp/vc-dispatcher.el (vc-resynch-window): Add new optional argument, call vc-file-clearprops when true. (vc-resynch-buffer): Add new optional argument, pass it down. (vc-resynch-buffers-in-directory): Likewise. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-09 05:24:01 +0000 +++ lisp/ChangeLog 2010-06-09 06:48:29 +0000 @@ -1,5 +1,11 @@ 2010-06-09 Dan Nicolaescu + Add optional support for resetting VC properties. + * vc-dispatcher.el (vc-resynch-window): Add new optional argument, + call vc-file-clearprops when true. + (vc-resynch-buffer): Add new optional argument, pass it down. + (vc-resynch-buffers-in-directory): Likewise. + Improve support for special markup in the VC commit message. * vc-mtn.el (vc-mtn-checkin): Add support for Author: and Date: markup. * vc-hg.el (vc-hg-checkin): Add support for Date:. === modified file 'lisp/vc-dispatcher.el' --- lisp/vc-dispatcher.el 2010-04-21 02:05:24 +0000 +++ lisp/vc-dispatcher.el 2010-06-09 06:48:29 +0000 @@ -446,7 +446,7 @@ (revert-buffer arg no-confirm t)) (vc-restore-buffer-context context))) -(defun vc-resynch-window (file &optional keep noquery) +(defun vc-resynch-window (file &optional keep noquery reset-vc-info) "If FILE is in the current buffer, either revert or unvisit it. The choice between revert (to see expanded keywords) and unvisit depends on KEEP. NOQUERY if non-nil inhibits confirmation for @@ -457,6 +457,8 @@ (and (string= buffer-file-name file) (if keep (when (file-exists-p file) + (when reset-vc-info + (vc-file-clearprops file)) (vc-revert-buffer-internal t noquery) ;; VC operations might toggle the read-only state. In @@ -477,24 +479,24 @@ (declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) (declare-function vc-string-prefix-p "vc" (prefix string)) -(defun vc-resynch-buffers-in-directory (directory &optional keep noquery) +(defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info) "Resync all buffers that visit files in DIRECTORY." (dolist (buffer (buffer-list)) (let ((fname (buffer-file-name buffer))) (when (and fname (vc-string-prefix-p directory fname)) (with-current-buffer buffer - (vc-resynch-buffer fname keep noquery)))))) + (vc-resynch-buffer fname keep noquery reset-vc-info)))))) -(defun vc-resynch-buffer (file &optional keep noquery) +(defun vc-resynch-buffer (file &optional keep noquery reset-vc-info) "If FILE is currently visited, resynch its buffer." (if (string= buffer-file-name file) - (vc-resynch-window file keep noquery) + (vc-resynch-window file keep noquery reset-vc-info) (if (file-directory-p file) - (vc-resynch-buffers-in-directory file keep noquery) + (vc-resynch-buffers-in-directory file keep noquery reset-vc-info) (let ((buffer (get-file-buffer file))) (when buffer (with-current-buffer buffer - (vc-resynch-window file keep noquery)))))) + (vc-resynch-window file keep noquery reset-vc-info)))))) ;; Try to avoid unnecessary work, a *vc-dir* buffer is only present ;; if this is true. (when vc-dir-buffers ------------------------------------------------------------ revno: 100548 committer: Dan Nicolaescu branch nick: trunk timestamp: Tue 2010-06-08 22:24:01 -0700 message: Improve support for special markup in the VC commit message. * lisp/vc-mtn.el (vc-mtn-checkin): Add support for Author: and Date: markup. * lisp/vc-hg.el (vc-hg-checkin): Add support for Date:. * lisp/vc-git.el (vc-git-checkin): * lisp/vc-bzr.el (vc-bzr-checkin): Likewise. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-06-05 09:56:22 +0000 +++ etc/NEWS 2010-06-09 05:24:01 +0000 @@ -183,6 +183,11 @@ Some backends handle some of those headers specially, but any unknown header is just left as is in the message, so it is not lost. +**** vc-git handles Author: and Date: +**** vc-hg handles Author: and Date: +**** vc-bzr handles Author:, Date: and Fixes: +**** vc-mtn handles Author: and Date: + ** Directory local variables can apply to file-less buffers. For example, adding "(diff-mode . ((mode . whitespace)))" to your .dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-09 02:58:26 +0000 +++ lisp/ChangeLog 2010-06-09 05:24:01 +0000 @@ -1,3 +1,11 @@ +2010-06-09 Dan Nicolaescu + + Improve support for special markup in the VC commit message. + * vc-mtn.el (vc-mtn-checkin): Add support for Author: and Date: markup. + * vc-hg.el (vc-hg-checkin): Add support for Date:. + * vc-git.el (vc-git-checkin): + * vc-bzr.el (vc-bzr-checkin): Likewise. + 2010-06-09 Stefan Monnier * emacs-lisp/smie.el (smie-indent-keyword): Remove special case that === modified file 'lisp/vc-bzr.el' --- lisp/vc-bzr.el 2010-06-01 02:34:49 +0000 +++ lisp/vc-bzr.el 2010-06-09 05:24:01 +0000 @@ -459,6 +459,7 @@ (if rev (error "Can't check in a specific revision with bzr")) (apply 'vc-bzr-command "commit" nil 0 files (cons "-m" (log-edit-extract-headers '(("Author" . "--author") + ("Date" . "--commit-time") ("Fixes" . "--fixes")) comment)))) === modified file 'lisp/vc-git.el' --- lisp/vc-git.el 2010-06-05 09:56:22 +0000 +++ lisp/vc-git.el 2010-06-09 05:24:01 +0000 @@ -554,7 +554,8 @@ (let ((coding-system-for-write vc-git-commits-coding-system)) (apply 'vc-git-command nil 0 files (nconc (list "commit" "-m") - (log-edit-extract-headers '(("Author" . "--author")) + (log-edit-extract-headers '(("Author" . "--author") + ("Date" . "--date")) comment) (list "--only" "--"))))) === modified file 'lisp/vc-hg.el' --- lisp/vc-hg.el 2010-05-08 18:47:07 +0000 +++ lisp/vc-hg.el 2010-06-09 05:24:01 +0000 @@ -429,7 +429,8 @@ REV is ignored." (apply 'vc-hg-command nil 0 files (nconc (list "commit" "-m") - (log-edit-extract-headers '(("Author" . "--user")) + (log-edit-extract-headers '(("Author" . "--user") + ("Date" . "--date")) comment)))) (defun vc-hg-find-revision (file rev buffer) === modified file 'lisp/vc-mtn.el' --- lisp/vc-mtn.el 2010-03-19 09:37:41 +0000 +++ lisp/vc-mtn.el 2010-06-09 05:24:01 +0000 @@ -173,7 +173,11 @@ (defun vc-mtn-could-register (file) (vc-mtn-root file)) (defun vc-mtn-checkin (files rev comment &optional extra-args-ignored) - (vc-mtn-command nil 0 files "commit" "-m" comment)) + (apply 'vc-mtn-command nil 0 files + (nconc (list "commit" "-m") + (log-edit-extract-headers '(("Author" . "--author") + ("Date" . "--date")) + comment)))) (defun vc-mtn-find-revision (file rev buffer) (vc-mtn-command buffer 0 file "cat" "-r" rev)) ------------------------------------------------------------ revno: 100547 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2010-06-08 22:58:26 -0400 message: * lisp/emacs-lisp/smie.el (smie-indent-keyword): Remove special case that can be handled with a ((:before "fn") (:prev "=>" parent)) rule. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-06-07 21:01:23 +0000 +++ lisp/ChangeLog 2010-06-09 02:58:26 +0000 @@ -1,3 +1,8 @@ +2010-06-09 Stefan Monnier + + * emacs-lisp/smie.el (smie-indent-keyword): Remove special case that + can be handled with a ((:before "fn") (:prev "=>" parent)) rule. + 2010-06-07 Martin Pohlack * iimage.el: Remove images as soon as the underlying text is modified. === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2010-06-07 19:37:50 +0000 +++ lisp/emacs-lisp/smie.el 2010-06-09 02:58:26 +0000 @@ -45,7 +45,7 @@ ;; the parser's state; ;; - because of that locality, indentation also works just fine when earlier ;; parts of the buffer are syntactically incorrect since the indentation -;; looks at "as little as possible" of the buffer make an indentation +;; looks at "as little as possible" of the buffer to make an indentation ;; decision. ;; - they typically have no error handling and can't even detect a parsing ;; error, so we don't have to worry about what to do in case of a syntax @@ -58,8 +58,10 @@ ;; and Ceriel Jacobs (BookBody.pdf available at ;; http://www.cs.vu.nl/~dick/PTAPG.html). ;; -;; OTOH we had to kill many chickens, read many coffee grounds, and practiced -;; untold numbers of black magic spells. +;; OTOH we had to kill many chickens, read many coffee grounds, and practice +;; untold numbers of black magic spells, to come up with the indentation code. +;; Since then, some of that code has been beaten into submission, but the +;; smie-indent-keyword is still pretty obscure. ;;; Code: @@ -700,12 +702,6 @@ ;; -> d ;; So as to align with the earliest appropriate place. (smie-indent-virtual)) - ((equal token (save-excursion - (funcall smie-backward-token-function))) - ;; in cases such as "fn x => fn y => fn z =>", - ;; jump back to the very first fn. - ;; FIXME: should we only do that for special tokens like "=>"? - (smie-indent-virtual)) ((setq tmp (assoc (cons (caddr res) token) smie-indent-rules)) (goto-char (cadr res)) ------------------------------------------------------------ revno: 100546 committer: Michael Albinus branch nick: trunk timestamp: Tue 2010-06-08 15:05:11 +0200 message: * auth-source.el (top): Autoload `secrets-list-collections', `secrets-create-item', `secrets-delete-item'. (auth-sources): Fix tag string. (auth-get-source, auth-source-retrieve, auth-source-create) (auth-source-delete): New defuns. (auth-source-pick): Rewrite in order to avoid 2 passes. (auth-source-forget-user-or-password): New parameter USERNAME. (auth-source-user-or-password): New parameters CREATE-MISSING and DELETE-EXISTING. Retrieve password interactively, if needed. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-06-07 23:00:42 +0000 +++ lisp/gnus/ChangeLog 2010-06-08 13:05:11 +0000 @@ -1,3 +1,15 @@ +2010-06-08 Michael Albinus + + * auth-source.el (top): Autoload `secrets-list-collections', + `secrets-create-item', `secrets-delete-item'. + (auth-sources): Fix tag string. + (auth-get-source, auth-source-retrieve, auth-source-create) + (auth-source-delete): New defuns. + (auth-source-pick): Rewrite in order to avoid 2 passes. + (auth-source-forget-user-or-password): New parameter USERNAME. + (auth-source-user-or-password): New parameters CREATE-MISSING and + DELETE-EXISTING. Retrieve password interactively, if needed. + 2010-06-07 Teemu Likonen (tiny change) * gnus-agent.el (gnus-agent-expire-unagentized-dirs): Don't ask about === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2010-03-29 09:28:20 +0000 +++ lisp/gnus/auth-source.el 2010-06-08 13:05:11 +0000 @@ -35,10 +35,13 @@ (eval-when-compile (require 'cl)) (autoload 'netrc-machine-user-or-password "netrc") -(autoload 'secrets-search-items "secrets") +(autoload 'secrets-create-item "secrets") +(autoload 'secrets-delete-item "secrets") (autoload 'secrets-get-alias "secrets") (autoload 'secrets-get-attribute "secrets") (autoload 'secrets-get-secret "secrets") +(autoload 'secrets-list-collections "secrets") +(autoload 'secrets-search-items "secrets") (defgroup auth-source nil "Authentication sources." @@ -122,7 +125,7 @@ (const :format "" :value :source) (choice :tag "Authentication backend choice" (string :tag "Authentication Source (file)") - (list :tag "secrets.el (Secret Service API/KWallet/GNOME KeyRing)" + (list :tag "secrets.el (Secret Service API/KWallet/GNOME Keyring)" (const :format "" :value :secrets) (choice :tag "Collection to use" (string :tag "Collection name") @@ -178,123 +181,182 @@ ;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe") ;; (auth-source-pick t :host "any" :protocol 'imap :user "joe") -;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") -;; (:source (:secrets "session") :host t :protocol t :user "joe") +;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") +;; (:source (:secrets "session") :host t :protocol t :user "joe") ;; (:source (:secrets "login") :host t :protocol t) ;; (:source "~/.authinfo.gpg" :host t :protocol t))) -;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") -;; (:source (:secrets "session") :host t :protocol t :user "joe") +;; (setq auth-sources '((:source (:secrets default) :host t :protocol t :user "joe") +;; (:source (:secrets "session") :host t :protocol t :user "joe") ;; (:source (:secrets "login") :host t :protocol t) ;; )) ;; (setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) +(defun auth-get-source (entry) + "Return the source string of ENTRY, which is one entry in `auth-sources'. +If it is a Secret Service API, return the collection name, otherwise +the file name." + (let ((source (plist-get entry :source))) + (if (stringp source) + source + ;; Secret Service API. + (setq source (plist-get source :secrets)) + (when (eq source 'default) + (setq source (or (secrets-get-alias "default") "login"))) + (or source "session")))) + (defun auth-source-pick (&rest spec) "Parse `auth-sources' for matches of the SPEC plist. Common keys are :host, :protocol, and :user. A value of t in SPEC means to always succeed in the match. A string value is -matched as a regex. - -The first pass skips fallback choices. If no choices are found -on the first pass, a second pass is made including the fallback -choices. - -For string (filename) sources, fallback choices are those where -PROTOCOL or HOST are nil. - -For secrets.el collections, the :host and :protocol keys are not -checked for fallback choices." - (let (choices) - (dolist (fallback '(nil t)) - (let ((keys (loop for i below (length spec) by 2 - collect (nth i spec))) - (default-session-fallback "login")) - (dolist (choice auth-sources) - (let* ((s (plist-get choice :source)) - ;; this is only set for Secret Service API specs (see secrets.el) - (coll (and (consp s) (plist-get s :secrets))) - (score 0)) - (cond - (coll ; use secrets.el here - (when (eq coll 'default) - (setq coll (secrets-get-alias "default")) - (unless coll - (auth-source-do-debug - "No 'default' alias. Trying collection '%s'." - default-session-fallback) - (setq coll default-session-fallback))) - (let* ((coll-search (cond - ((stringp coll) coll) - - ;; when the collection is nil: - ;; in fallback mode, accept it as any - ;; otherwise, hope to fail - ((null coll) (if fallback - nil - " *fallback-fail*")))) - ;; assemble a search query for secrets-search-items - ;; in fallback mode, host and protocol are not checked - (other-search (loop for k - in (if fallback - (remove :host - (remove :protocol keys)) - keys) - append (list - k - ;; convert symbols to a string - (let ((v (plist-get spec k))) - (if (stringp v) - v - (prin1-to-string v)))))) - ;; the score is based on how exact the search was, - ;; plus base score = 1 for any match - (score (1+ (length other-search))) - (results (apply 'secrets-search-items - coll-search - other-search))) - (auth-source-do-debug - "auth-source-pick: got items %s in collection '%s' + %s" - results coll-search other-search) - ;; put the results in the choices variable - (dolist (result results) - (setq choices (cons (list score - `(:source secrets - :item ,result - :collection ,coll - :search ,coll-search - ,@other-search)) - choices))))) - ;; this is any non-secrets spec (currently means a string filename) - (t - (let ((match t)) - (dolist (k keys) - (let* ((v (plist-get spec k)) - (choicev (plist-get choice k))) - (setq match - (and match - (or (eq t choicev) ; source always matches spec key - ;; source key gives regex to match against spec - (and (stringp choicev) (string-match choicev v)) - ;; source key gives symbol to match against spec - (and (symbolp choicev) (eq choicev v)) - ;; in fallback mode, missing source key is OK - fallback))) - (when match (incf score)))) ; increment the score for each match - - ;; now if the whole iteration resulted in a match: - (when match - (setq choices (cons (list score choice) choices)))))))) - ;; when there were matches, skip the second pass - (when choices (return choices)))) - - ;; return the results sorted by score - (mapcar 'cadr (sort choices (lambda (x y) (> (car x) (car y))))))) - -(defun auth-source-forget-user-or-password (mode host protocol) +matched as a regex." + (let ((keys (loop for i below (length spec) by 2 collect (nth i spec))) + choices) + (dolist (choice (copy-tree auth-sources) choices) + (let ((source (plist-get choice :source)) + (match t)) + (when + (and + ;; Check existence of source. + (if (consp source) + ;; Secret Service API. + (member (auth-get-source choice) (secrets-list-collections)) + ;; authinfo file. + (file-exists-p source)) + + ;; Check keywords. + (dolist (k keys match) + (let* ((v (plist-get spec k)) + (choicev (plist-get choice k))) + (setq match + (and match + (or + ;; source always matches spec key + (eq t choicev) + ;; source key gives regex to match against spec + (and (stringp choicev) (string-match choicev v)) + ;; source key gives symbol to match against spec + (and (symbolp choicev) (eq choicev v)))))))) + + (add-to-list 'choices choice 'append)))))) + +(defun auth-source-retrieve (mode entry &rest spec) + "Retrieve MODE credentials according to SPEC from ENTRY." + (catch 'no-password + (let ((host (plist-get spec :host)) + (user (plist-get spec :user)) + (prot (plist-get spec :protocol)) + (source (plist-get entry :source)) + result) + (cond + ;; Secret Service API. + ((consp source) + (let ((coll (auth-get-source entry)) + item) + ;; Loop over candidates with a matching host attribute. + (dolist (elt (secrets-search-items coll :host host) item) + (when (and (or (not user) + (string-equal + user (secrets-get-attribute coll elt :user))) + (or (not prot) + (string-equal + prot (secrets-get-attribute coll elt :protocol)))) + (setq item elt) + (return elt))) + ;; Compose result. + (when item + (setq result + (mapcar (lambda (m) + (if (string-equal "password" m) + (or (secrets-get-secret coll item) + ;; When we do not find a password, + ;; we return nil anyway. + (throw 'no-password nil)) + (or (secrets-get-attribute coll item :user) + user))) + (if (consp mode) mode (list mode))))) + (if (consp mode) result (car result)))) + ;; Anything else is netrc. + (t + (let ((search (list source (list host) (list (format "%s" prot)) + (auth-source-protocol-defaults prot)))) + (setq result + (mapcar (lambda (m) + (if (string-equal "password" m) + (or (apply + 'netrc-machine-user-or-password m search) + ;; When we do not find a password, we + ;; return nil anyway. + (throw 'no-password nil)) + (or (apply + 'netrc-machine-user-or-password m search) + user))) + (if (consp mode) mode (list mode))))) + (if (consp mode) result (car result))))))) + +(defun auth-source-create (mode entry &rest spec) + "Create interactively credentials according to SPEC in ENTRY. +Return structure as specified by MODE." + (let* ((host (plist-get spec :host)) + (user (plist-get spec :user)) + (prot (plist-get spec :protocol)) + (source (plist-get entry :source)) + (name (concat (if user (format "%s@" user)) + host + (if prot (format ":%s" prot)))) + result) + (setq result + (mapcar + (lambda (m) + (if (equal "password" m) + (let ((passwd (read-passwd "Password: "))) + (cond + ;; Secret Service API. + ((consp source) + (apply + 'secrets-create-item + (auth-get-source entry) name passwd spec)) + (t)) ;; netrc not implemented yes. + passwd) + (or + ;; the originally requested :user + user + "unknown-user"))) + (if (consp mode) mode (list mode)))) + (if (consp mode) result (car result)))) + +(defun auth-source-delete (entry &rest spec) + "Delete credentials according to SPEC in ENTRY." + (let ((host (plist-get spec :host)) + (user (plist-get spec :user)) + (prot (plist-get spec :protocol)) + (source (plist-get entry :source))) + (cond + ;; Secret Service API. + ((consp source) + (let ((coll (auth-get-source entry))) + ;; Loop over candidates with a matching host attribute. + (dolist (elt (secrets-search-items coll :host host)) + (when (and (or (not user) + (string-equal + user (secrets-get-attribute coll elt :user))) + (or (not prot) + (string-equal + prot (secrets-get-attribute coll elt :protocol)))) + (secrets-delete-item coll elt))))) + (t)))) ;; netrc not implemented yes. + +(defun auth-source-forget-user-or-password + (mode host protocol &optional username) + "Remove cached authentication token." (interactive "slogin/password: \nsHost: \nsProtocol: \n") ;for testing - (remhash (format "%s %s:%s" mode host protocol) auth-source-cache)) + (remhash + (if username + (format "%s %s:%s %s" mode host protocol username) + (format "%s %s:%s" mode host protocol)) + auth-source-cache)) (defun auth-source-forget-all-cached () "Forget all cached auth-source authentication tokens." @@ -308,7 +370,8 @@ ;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "tzz") ;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" "other" "joe"))) -(defun auth-source-user-or-password (mode host protocol &optional username) +(defun auth-source-user-or-password + (mode host protocol &optional username create-missing delete-existing) "Find MODE (string or list of strings) matching HOST and PROTOCOL. USERNAME is optional and will be used as \"login\" in a search @@ -317,17 +380,31 @@ username \"joe\" and it matches an item but the item doesn't have a :user attribute, the username \"joe\" will be returned. -MODE can be \"login\" or \"password\" for example." +A non nil DELETE-EXISTING means deleting any matching password +entry in the respective sources. This is useful only when +CREATE-MISSING is non nil as well; the intended use case is to +remove wrong password entries. + +If no matching entry is found, and CREATE-MISSING is non nil, +the password will be retrieved interactively, and it will be +stored in the password database which matches best (see +`auth-sources'). + +MODE can be \"login\" or \"password\"." (auth-source-do-debug "auth-source-user-or-password: get %s for %s (%s) + user=%s" mode host protocol username) (let* ((listy (listp mode)) (mode (if listy mode (list mode))) - (extras (when username `(:user ,username))) - (cname (format "%s %s:%s %s" mode host protocol extras)) + (cname (if username + (format "%s %s:%s %s" mode host protocol username) + (format "%s %s:%s" mode host protocol))) (search (list :host host :protocol protocol)) (search (if username (append search (list :user username)) search)) - (found (gethash cname auth-source-cache))) + (found (if (not delete-existing) + (gethash cname auth-source-cache) + (remhash cname auth-source-cache) + nil))) (if found (progn (auth-source-do-debug @@ -337,45 +414,35 @@ (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found) - host protocol extras) + host protocol username) found) ; return the found data ;; else, if not found - (dolist (choice (apply 'auth-source-pick search)) - (setq found (cond - ;; the secrets.el spec - ((eq (plist-get choice :source) 'secrets) - (let ((coll (plist-get choice :search)) - (item (plist-get choice :item))) - (mapcar (lambda (m) - (if (equal "password" m) - (secrets-get-secret coll item) - ;; the user name is either - (or - ;; the secret's attribute :user, or - (secrets-get-attribute coll item :user) - ;; the originally requested :user - username - "unknown-user"))) - mode))) - (t ; anything else is netrc - (netrc-machine-user-or-password - mode - (plist-get choice :source) - (list host) - (list (format "%s" protocol)) - (auth-source-protocol-defaults protocol))))) + (let ((choices (apply 'auth-source-pick search))) + (dolist (choice choices) + (if delete-existing + (apply 'auth-source-delete choice search) + (setq found (apply 'auth-source-retrieve mode choice search))) + (and found (return found))) + + ;; We haven't found something, so we will create it interactively. + (when (and (not found) choices create-missing) + (setq found (apply 'auth-source-create mode (car choices) search))) + + ;; Cache the result. (when found (auth-source-do-debug "auth-source-user-or-password: found %s=%s for %s (%s) + %s" mode ;; don't show the password - (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found) - host protocol extras) + (if (and (member "password" mode) auth-source-hide-passwords) + "SECRET" found) + host protocol username) (setq found (if listy found (car-safe found))) (when auth-source-do-cache (puthash cname found auth-source-cache))) - (return found))))) - + + found)))) + (defun auth-source-protocol-defaults (protocol) "Return a list of default ports and names for PROTOCOL." (cdr-safe (assoc protocol auth-source-protocols))) ------------------------------------------------------------ revno: 100545 committer: Dan Nicolaescu branch nick: trunk timestamp: Mon 2010-06-07 20:12:21 -0700 message: * src/lread.c (X_OK): Remove, unused. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-06-08 03:06:47 +0000 +++ src/ChangeLog 2010-06-08 03:12:21 +0000 @@ -1,5 +1,7 @@ 2010-06-08 Dan Nicolaescu + * lread.c (X_OK): Remove, unused. + * dispnew.c: Remove obsolete comment. Remove INCLUDED_FCNTL. === modified file 'src/lread.c' --- src/lread.c 2010-04-20 01:50:52 +0000 +++ src/lread.c 2010-06-08 03:12:21 +0000 @@ -48,10 +48,6 @@ #include #endif -#ifndef X_OK -#define X_OK 01 -#endif - #include #ifdef HAVE_SETLOCALE