aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-02-12 12:00:35 -0800
committerPaul Eggert2011-02-12 12:00:35 -0800
commit583dab51b0c1962c10d5b8baf9da7af7921e8775 (patch)
tree69e6178b399ecfaed2e3b757e2d68e96b7b0334d
parent64640ce2d31c153698c501e9385e3d5397181de9 (diff)
parent470d996db4b850a0c4676e03de805e53703b80e0 (diff)
downloademacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.tar.gz
emacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.zip
Merge from mainline.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog29
-rw-r--r--lisp/files.el44
-rw-r--r--lisp/mail/smtpmail.el14
-rw-r--r--lisp/minibuffer.el4
-rw-r--r--lisp/net/imap-hash.el13
-rw-r--r--lisp/net/tramp-imap.el12
-rw-r--r--lisp/net/tramp.el24
-rw-r--r--lisp/url/ChangeLog10
-rw-r--r--lisp/url/url-auth.el25
-rw-r--r--lisp/url/url-parse.el17
-rw-r--r--src/ChangeLog14
-rw-r--r--src/callproc.c32
-rw-r--r--src/process.c6
-rw-r--r--src/xdisp.c38
15 files changed, 227 insertions, 60 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 11425c21342..6e9171e55c8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -633,6 +633,11 @@ Notifications API. It requires D-Bus for communication.
633 633
634* Incompatible Lisp Changes in Emacs 24.1 634* Incompatible Lisp Changes in Emacs 24.1
635 635
636** `copy-directory' now copies the source directory as a subdirectory
637of the target directory, if the latter is an existing directory. The
638new optional arg COPY-CONTENTS, if non-nil, makes the function copy
639the contents directly into a pre-existing target directory.
640
636** `compose-mail' now accepts an optional 8th arg, RETURN-ACTION, and 641** `compose-mail' now accepts an optional 8th arg, RETURN-ACTION, and
637passes it to the mail user agent function. This argument specifies an 642passes it to the mail user agent function. This argument specifies an
638action for returning to the caller after finishing with the mail. 643action for returning to the caller after finishing with the mail.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e8308059963..e80de4e9175 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,32 @@
12011-02-12 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2
3 * files.el (copy-directory): New argument COPY-CONTENTS for
4 copying directory contents into another existing directory.
5
62011-02-12 Tassilo Horn <tassilo@member.fsf.org>
7
8 * minibuffer.el (completion-table-case-fold): New function for
9 creating a case-insensitive completion table.
10
112011-02-12 Teodor Zlatanov <tzz@lifelogs.com>
12
13 * net/tramp.el (tramp-default-method): Also check if
14 `auth-source-search' is bound.
15 (tramp-read-passwd): Use `auth-source-search' instead of
16 `auto-source-user-or-password'.
17
18 * net/tramp-imap.el: Autoload `auto-source-search' instead of
19 `auto-source-user-or-password.
20 (tramp-imap-passphrase-callback-function): Use it.
21
22 * net/imap-hash.el: Autoload `auto-source-search' instead of
23 `auto-source-user-or-password.
24 (imap-hash-open-connection): Use it.
25
26 * mail/smtpmail.el: Autoload `auto-source-search' instead of
27 `auto-source-user-or-password.
28 (smtpmail-try-auth-methods): Use it.
29
12011-02-12 Phil Hagelberg <phil@hagelb.org> 302011-02-12 Phil Hagelberg <phil@hagelb.org>
2 31
3 * emacs-lisp/package.el: Allow packages to be reinstalled. 32 * emacs-lisp/package.el: Allow packages to be reinstalled.
diff --git a/lisp/files.el b/lisp/files.el
index 43b31cb0a7a..2d3dbc67d72 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4826,10 +4826,8 @@ given. With a prefix argument, TRASH is nil."
4826 directory 'full directory-files-no-dot-files-regexp))) 4826 directory 'full directory-files-no-dot-files-regexp)))
4827 (delete-directory-internal directory))))) 4827 (delete-directory-internal directory)))))
4828 4828
4829(defun copy-directory (directory newname &optional keep-time parents) 4829(defun copy-directory (directory newname &optional keep-time parents copy-contents)
4830 "Copy DIRECTORY to NEWNAME. Both args must be strings. 4830 "Copy DIRECTORY to NEWNAME. Both args must be strings.
4831If NEWNAME names an existing directory, copy DIRECTORY as subdirectory there.
4832
4833This function always sets the file modes of the output files to match 4831This function always sets the file modes of the output files to match
4834the corresponding input file. 4832the corresponding input file.
4835 4833
@@ -4840,7 +4838,12 @@ A prefix arg makes KEEP-TIME non-nil.
4840 4838
4841Noninteractively, the last argument PARENTS says whether to 4839Noninteractively, the last argument PARENTS says whether to
4842create parent directories if they don't exist. Interactively, 4840create parent directories if they don't exist. Interactively,
4843this happens by default." 4841this happens by default.
4842
4843If NEWNAME names an existing directory, copy DIRECTORY as a
4844subdirectory there. However, if called from Lisp with a non-nil
4845optional argument COPY-CONTENTS, copy the contents of DIRECTORY
4846directly into NEWNAME instead."
4844 (interactive 4847 (interactive
4845 (let ((dir (read-directory-name 4848 (let ((dir (read-directory-name
4846 "Copy directory: " default-directory default-directory t nil))) 4849 "Copy directory: " default-directory default-directory t nil)))
@@ -4848,7 +4851,7 @@ this happens by default."
4848 (read-file-name 4851 (read-file-name
4849 (format "Copy directory %s to: " dir) 4852 (format "Copy directory %s to: " dir)
4850 default-directory default-directory nil nil) 4853 default-directory default-directory nil nil)
4851 current-prefix-arg t))) 4854 current-prefix-arg t nil)))
4852 ;; If default-directory is a remote directory, make sure we find its 4855 ;; If default-directory is a remote directory, make sure we find its
4853 ;; copy-directory handler. 4856 ;; copy-directory handler.
4854 (let ((handler (or (find-file-name-handler directory 'copy-directory) 4857 (let ((handler (or (find-file-name-handler directory 'copy-directory)
@@ -4860,21 +4863,22 @@ this happens by default."
4860 (setq directory (directory-file-name (expand-file-name directory)) 4863 (setq directory (directory-file-name (expand-file-name directory))
4861 newname (directory-file-name (expand-file-name newname))) 4864 newname (directory-file-name (expand-file-name newname)))
4862 4865
4863 (if (not (file-directory-p newname)) 4866 (cond ((not (file-directory-p newname))
4864 ;; If NEWNAME is not an existing directory, create it; that 4867 ;; If NEWNAME is not an existing directory, create it;
4865 ;; is where we will copy the files of DIRECTORY. 4868 ;; that is where we will copy the files of DIRECTORY.
4866 (make-directory newname parents) 4869 (make-directory newname parents))
4867 ;; If NEWNAME is an existing directory, we will copy into 4870 ;; If NEWNAME is an existing directory and COPY-CONTENTS
4868 ;; NEWNAME/[DIRECTORY-BASENAME]. 4871 ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME].
4869 (setq newname (expand-file-name 4872 ((not copy-contents)
4870 (file-name-nondirectory 4873 (setq newname (expand-file-name
4871 (directory-file-name directory)) 4874 (file-name-nondirectory
4872 newname)) 4875 (directory-file-name directory))
4873 (and (file-exists-p newname) 4876 newname))
4874 (not (file-directory-p newname)) 4877 (and (file-exists-p newname)
4875 (error "Cannot overwrite non-directory %s with a directory" 4878 (not (file-directory-p newname))
4876 newname)) 4879 (error "Cannot overwrite non-directory %s with a directory"
4877 (make-directory newname t)) 4880 newname))
4881 (make-directory newname t)))
4878 4882
4879 ;; Copy recursively. 4883 ;; Copy recursively.
4880 (dolist (file 4884 (dolist (file
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f726304704b..427d9d17746 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -77,7 +77,7 @@
77(autoload 'netrc-machine "netrc") 77(autoload 'netrc-machine "netrc")
78(autoload 'netrc-get "netrc") 78(autoload 'netrc-get "netrc")
79(autoload 'password-read "password-cache") 79(autoload 'password-read "password-cache")
80(autoload 'auth-source-user-or-password "auth-source") 80(autoload 'auth-source-search "auth-source")
81 81
82;;; 82;;;
83(defgroup smtpmail nil 83(defgroup smtpmail nil
@@ -538,10 +538,14 @@ The list is in preference order.")
538(defun smtpmail-try-auth-methods (process supported-extensions host port) 538(defun smtpmail-try-auth-methods (process supported-extensions host port)
539 (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) 539 (let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
540 (mech (car (smtpmail-intersection mechs smtpmail-auth-supported))) 540 (mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
541 (auth-user (auth-source-user-or-password 541 (auth-info (auth-source-search :max 1
542 "login" host (or port "smtp"))) 542 :host host
543 (auth-pass (auth-source-user-or-password 543 :port (or port "smtp")))
544 "password" host (or port "smtp"))) 544 (auth-user (plist-get (nth 0 auth-info) :user))
545 (auth-pass (plist-get (nth 0 auth-info) :secret))
546 (auth-pass (if (functionp auth-pass)
547 (funcall auth-pass)
548 auth-pass))
545 (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-* 549 (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-*
546 (list host port auth-user auth-pass) 550 (list host port auth-user auth-pass)
547 ;; else, if auth-source didn't return them... 551 ;; else, if auth-source didn't return them...
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 1b42ee1f2ce..3c8628c9cfa 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -196,6 +196,10 @@ You should give VAR a non-nil `risky-local-variable' property."
196 (setq ,var (,fun))) 196 (setq ,var (,fun)))
197 ,var)))) 197 ,var))))
198 198
199(defun completion-table-case-fold (table string pred action)
200 (let ((completion-ignore-case t))
201 (complete-with-action action table string pred)))
202
199(defun completion-table-with-context (prefix table string pred action) 203(defun completion-table-with-context (prefix table string pred action)
200 ;; TODO: add `suffix' maybe? 204 ;; TODO: add `suffix' maybe?
201 ;; Notice that `pred' may not be a function in some abusive cases. 205 ;; Notice that `pred' may not be a function in some abusive cases.
diff --git a/lisp/net/imap-hash.el b/lisp/net/imap-hash.el
index d21b714d950..a07277cee68 100644
--- a/lisp/net/imap-hash.el
+++ b/lisp/net/imap-hash.el
@@ -43,7 +43,7 @@
43(require 'imap) 43(require 'imap)
44(require 'sendmail) ; for mail-header-separator 44(require 'sendmail) ; for mail-header-separator
45(require 'message) 45(require 'message)
46(autoload 'auth-source-user-or-password "auth-source") 46(autoload 'auth-source-search "auth-source")
47 47
48;; retrieve these headers 48;; retrieve these headers
49(defvar imap-hash-headers 49(defvar imap-hash-headers
@@ -267,13 +267,14 @@ The function is passed the message headers (see `imap-hash-get-headers')."
267 (imap-hash-password iht)))) 267 (imap-hash-password iht))))
268 ;; this will not be needed if auth-need is t 268 ;; this will not be needed if auth-need is t
269 (auth-info (when auth-need 269 (auth-info (when auth-need
270 (auth-source-user-or-password 270 (nth 0 (auth-source-search :host server :port port))))
271 '("login" "password")
272 server port)))
273 (auth-user (or (imap-hash-user iht) 271 (auth-user (or (imap-hash-user iht)
274 (nth 0 auth-info))) 272 (plist-get auth-info :user)))
275 (auth-passwd (or (imap-hash-password iht) 273 (auth-passwd (or (imap-hash-password iht)
276 (nth 1 auth-info))) 274 (plist-get auth-info :secret)))
275 (auth-passwd (if (functionp auth-passwd)
276 (funcall auth-passwd)
277 auth-passwd))
277 (imap-logout-timeout nil)) 278 (imap-logout-timeout nil))
278 279
279 ;; (debug "opening server: opened+state" (imap-opened) imap-state) 280 ;; (debug "opening server: opened+state" (imap-opened) imap-state)
diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el
index 3a536103c3d..4157265b0e1 100644
--- a/lisp/net/tramp-imap.el
+++ b/lisp/net/tramp-imap.el
@@ -56,7 +56,7 @@
56(require 'assoc) 56(require 'assoc)
57(require 'tramp) 57(require 'tramp)
58 58
59(autoload 'auth-source-user-or-password "auth-source") 59(autoload 'auth-source-search "auth-source")
60(autoload 'epg-context-operation "epg") 60(autoload 'epg-context-operation "epg")
61(autoload 'epg-context-set-armor "epg") 61(autoload 'epg-context-set-armor "epg")
62(autoload 'epg-context-set-passphrase-callback "epg") 62(autoload 'epg-context-set-passphrase-callback "epg")
@@ -639,8 +639,14 @@ HANDBACK is just carried through.
639KEY-ID can be 'SYM or 'PIN among others." 639KEY-ID can be 'SYM or 'PIN among others."
640 (let* ((server tramp-current-host) 640 (let* ((server tramp-current-host)
641 (port "tramp-imap") ; this is NOT the server password! 641 (port "tramp-imap") ; this is NOT the server password!
642 (auth-passwd 642 (auth-passwd (plist-get
643 (auth-source-user-or-password "password" server port))) 643 (nth 0 (auth-source-search :max 1
644 :host server
645 :port port))
646 :secret))
647 (auth-passwd (if (functionp auth-passwd)
648 (funcall auth-passwd)
649 auth-passwd)))
644 (or 650 (or
645 (copy-sequence auth-passwd) 651 (copy-sequence auth-passwd)
646 ;; If we cache the passphrase and we have one. 652 ;; If we cache the passphrase and we have one.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8584d4ddc92..5d0f3935884 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -297,6 +297,7 @@ shouldn't return t when it isn't."
297 (executable-find "pscp")) 297 (executable-find "pscp"))
298 (if (or (fboundp 'password-read) 298 (if (or (fboundp 'password-read)
299 (fboundp 'auth-source-user-or-password) 299 (fboundp 'auth-source-user-or-password)
300 (fboundp 'auth-source-search)
300 ;; Pageant is running. 301 ;; Pageant is running.
301 (tramp-compat-process-running-p "Pageant")) 302 (tramp-compat-process-running-p "Pageant"))
302 "pscp" 303 "pscp"
@@ -307,6 +308,7 @@ shouldn't return t when it isn't."
307 ((tramp-detect-ssh-controlmaster) "scpc") 308 ((tramp-detect-ssh-controlmaster) "scpc")
308 ((or (fboundp 'password-read) 309 ((or (fboundp 'password-read)
309 (fboundp 'auth-source-user-or-password) 310 (fboundp 'auth-source-user-or-password)
311 (fboundp 'auth-source-search)
310 ;; ssh-agent is running. 312 ;; ssh-agent is running.
311 (getenv "SSH_AUTH_SOCK") 313 (getenv "SSH_AUTH_SOCK")
312 (getenv "SSH_AGENT_PID")) 314 (getenv "SSH_AGENT_PID"))
@@ -3519,7 +3521,8 @@ Invokes `password-read' if available, `read-passwd' else."
3519 (or prompt 3521 (or prompt
3520 (with-current-buffer (process-buffer proc) 3522 (with-current-buffer (process-buffer proc)
3521 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 3523 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
3522 (format "%s for %s " (capitalize (match-string 1)) key))))) 3524 (format "%s for %s " (capitalize (match-string 1)) key))))
3525 auth-info auth-passwd)
3523 (with-parsed-tramp-file-name key nil 3526 (with-parsed-tramp-file-name key nil
3524 (prog1 3527 (prog1
3525 (or 3528 (or
@@ -3527,9 +3530,22 @@ Invokes `password-read' if available, `read-passwd' else."
3527 (and (boundp 'auth-sources) 3530 (and (boundp 'auth-sources)
3528 (tramp-get-connection-property v "first-password-request" nil) 3531 (tramp-get-connection-property v "first-password-request" nil)
3529 ;; Try with Tramp's current method. 3532 ;; Try with Tramp's current method.
3530 (tramp-compat-funcall 3533 (if (fboundp 'auth-source-search)
3531 'auth-source-user-or-password 3534 (progn
3532 "password" tramp-current-host tramp-current-method)) 3535 (setq auth-info
3536 (tramp-compat-funcall
3537 'auth-source-search
3538 :max 1
3539 :user (or tramp-current-user t)
3540 :host tramp-current-host
3541 :port tramp-current-method))
3542 (setq auth-passwd (plist-get (nth 0 auth-info) :secret))
3543 (setq auth-passwd (if (functionp auth-passwd)
3544 (funcall auth-passwd)
3545 auth-passwd)))
3546 (tramp-compat-funcall
3547 'auth-source-user-or-password
3548 "password" tramp-current-host tramp-current-method)))
3533 ;; Try the password cache. 3549 ;; Try the password cache.
3534 (when (functionp 'password-read) 3550 (when (functionp 'password-read)
3535 (unless (tramp-get-connection-property 3551 (unless (tramp-get-connection-property
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 742a3cfb9b5..3c7b8b6abe7 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,13 @@
12011-02-12 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * url-parse.el (url-bit-for-url, url-user-for-url)
4 (url-password-for-url): Use `auto-source-search' instead of
5 `auto-source-user-or-password'.
6
7 * url-auth.el: Autoload `auto-source-search' instead of
8 `auto-source-user-or-password'.
9 (url-basic-auth, url-digest-auth, url-do-auth-source-search): Use it.
10
12011-02-03 Lars Ingebrigtsen <larsi@gnus.org> 112011-02-03 Lars Ingebrigtsen <larsi@gnus.org>
2 12
3 * url-http.el (url-http-wait-for-headers-change-function): Don't 13 * url-http.el (url-http-wait-for-headers-change-function): Don't
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 842e2a3be8d..5261302a15c 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -24,7 +24,7 @@
24(require 'url-vars) 24(require 'url-vars)
25(require 'url-parse) 25(require 'url-parse)
26(autoload 'url-warn "url") 26(autoload 'url-warn "url")
27(autoload 'auth-source-user-or-password "auth-source") 27(autoload 'auth-source-search "auth-source")
28 28
29(defsubst url-auth-user-prompt (url realm) 29(defsubst url-auth-user-prompt (url realm)
30 "String to usefully prompt for a username." 30 "String to usefully prompt for a username."
@@ -81,11 +81,11 @@ instead of the filename inheritance method."
81 (cond 81 (cond
82 ((and prompt (not byserv)) 82 ((and prompt (not byserv))
83 (setq user (or 83 (setq user (or
84 (auth-source-user-or-password "login" server type) 84 (url-do-auth-source-search server type :user)
85 (read-string (url-auth-user-prompt url realm) 85 (read-string (url-auth-user-prompt url realm)
86 (or user (user-real-login-name)))) 86 (or user (user-real-login-name))))
87 pass (or 87 pass (or
88 (auth-source-user-or-password "password" server type) 88 (url-do-auth-source-search server type :secret)
89 (read-passwd "Password: " nil (or pass "")))) 89 (read-passwd "Password: " nil (or pass ""))))
90 (set url-basic-auth-storage 90 (set url-basic-auth-storage
91 (cons (list server 91 (cons (list server
@@ -110,11 +110,11 @@ instead of the filename inheritance method."
110 (if (or (and (not retval) prompt) overwrite) 110 (if (or (and (not retval) prompt) overwrite)
111 (progn 111 (progn
112 (setq user (or 112 (setq user (or
113 (auth-source-user-or-password "login" server type) 113 (url-do-auth-source-search server type :user)
114 (read-string (url-auth-user-prompt url realm) 114 (read-string (url-auth-user-prompt url realm)
115 (user-real-login-name))) 115 (user-real-login-name)))
116 pass (or 116 pass (or
117 (auth-source-user-or-password "password" server type) 117 (url-do-auth-source-search server type :secret)
118 (read-passwd "Password: ")) 118 (read-passwd "Password: "))
119 retval (base64-encode-string (format "%s:%s" user pass)) 119 retval (base64-encode-string (format "%s:%s" user pass))
120 byserv (assoc server (symbol-value url-basic-auth-storage))) 120 byserv (assoc server (symbol-value url-basic-auth-storage)))
@@ -173,11 +173,11 @@ instead of hostname:portnum."
173 (cond 173 (cond
174 ((and prompt (not byserv)) 174 ((and prompt (not byserv))
175 (setq user (or 175 (setq user (or
176 (auth-source-user-or-password "login" server type) 176 (url-do-auth-source-search server type :user)
177 (read-string (url-auth-user-prompt url realm) 177 (read-string (url-auth-user-prompt url realm)
178 (user-real-login-name))) 178 (user-real-login-name)))
179 pass (or 179 pass (or
180 (auth-source-user-or-password "password" server type) 180 (url-do-auth-source-search server type :secret)
181 (read-passwd "Password: ")) 181 (read-passwd "Password: "))
182 url-digest-auth-storage 182 url-digest-auth-storage
183 (cons (list server 183 (cons (list server
@@ -204,11 +204,11 @@ instead of hostname:portnum."
204 (if overwrite 204 (if overwrite
205 (if (and (not retval) prompt) 205 (if (and (not retval) prompt)
206 (setq user (or 206 (setq user (or
207 (auth-source-user-or-password "login" server type) 207 (url-do-auth-source-search server type :user)
208 (read-string (url-auth-user-prompt url realm) 208 (read-string (url-auth-user-prompt url realm)
209 (user-real-login-name))) 209 (user-real-login-name)))
210 pass (or 210 pass (or
211 (auth-source-user-or-password "password" server type) 211 (url-do-auth-source-search server type :secret)
212 (read-passwd "Password: ")) 212 (read-passwd "Password: "))
213 retval (setq retval 213 retval (setq retval
214 (cons user 214 (cons user
@@ -244,6 +244,13 @@ instead of hostname:portnum."
244 "A list of the registered authorization schemes and various and sundry 244 "A list of the registered authorization schemes and various and sundry
245information associated with them.") 245information associated with them.")
246 246
247(defun url-do-auth-source-search (server type parameter)
248 (let* ((auth-info (auth-source-search :max 1 :host server :port type))
249 (auth-info (nth 0 auth-info))
250 (token (plist-get auth-info parameter))
251 (token (if (functionp token) (funcall token) token)))
252 token))
253
247;;;###autoload 254;;;###autoload
248(defun url-get-authentication (url realm type prompt &optional args) 255(defun url-get-authentication (url realm type prompt &optional args)
249 "Return an authorization string suitable for use in the WWW-Authenticate 256 "Return an authorization string suitable for use in the WWW-Authenticate
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index 950f666e9c7..71c03bf1edd 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -178,20 +178,25 @@ TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS."
178 `(let* ((urlobj (url-generic-parse-url url)) 178 `(let* ((urlobj (url-generic-parse-url url))
179 (bit (funcall ,method urlobj)) 179 (bit (funcall ,method urlobj))
180 (methods (list 'url-recreate-url 180 (methods (list 'url-recreate-url
181 'url-host))) 181 'url-host))
182 auth-info)
182 (while (and (not bit) (> (length methods) 0)) 183 (while (and (not bit) (> (length methods) 0))
183 (setq bit 184 (setq auth-info (auth-source-search
184 (auth-source-user-or-password 185 :max 1
185 ,lookfor (funcall (pop methods) urlobj) (url-type urlobj)))) 186 :host (funcall (pop methods) urlobj)
187 :port (url-type urlobj)))
188 (setq bit (plist-get (nth 0 auth-info) ,lookfor))
189 (when (functionp bit)
190 (setq bit (funcall bit))))
186 bit)) 191 bit))
187 192
188(defun url-user-for-url (url) 193(defun url-user-for-url (url)
189 "Attempt to use .authinfo to find a user for this URL." 194 "Attempt to use .authinfo to find a user for this URL."
190 (url-bit-for-url 'url-user "login" url)) 195 (url-bit-for-url 'url-user :user url))
191 196
192(defun url-password-for-url (url) 197(defun url-password-for-url (url)
193 "Attempt to use .authinfo to find a password for this URL." 198 "Attempt to use .authinfo to find a password for this URL."
194 (url-bit-for-url 'url-password "password" url)) 199 (url-bit-for-url 'url-password :secret url))
195 200
196(provide 'url-parse) 201(provide 'url-parse)
197 202
diff --git a/src/ChangeLog b/src/ChangeLog
index 43ca62aedfc..031b254739e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12011-02-12 Andreas Schwab <schwab@linux-m68k.org>
2
3 * process.c (create_process): Reset SIGPIPE handler in the child.
4 * callproc.c (Fcall_process): Likewise. (Bug#5238)
5
62011-02-12 Eli Zaretskii <eliz@gnu.org>
7
8 * xdisp.c <this_line_min_pos>: New variable.
9 (move_it_in_display_line_to): Record in this_line_min_pos the
10 smallest position iterated across.
11 (display_line): Use this_line_min_pos to record the smallest
12 position in the line even if it is not displayed due to
13 hscrolling. (Bug#7939)
14
12011-02-12 Paul Eggert <eggert@cs.ucla.edu> 152011-02-12 Paul Eggert <eggert@cs.ucla.edu>
2 16
3 Remove no-longer needed getloadavg symbols. 17 Remove no-longer needed getloadavg symbols.
diff --git a/src/callproc.c b/src/callproc.c
index 925eefb4b02..27e8493bcf1 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -445,6 +445,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
445 register char **save_environ = environ; 445 register char **save_environ = environ;
446 register int fd1 = fd[1]; 446 register int fd1 = fd[1];
447 int fd_error = fd1; 447 int fd_error = fd1;
448#ifdef HAVE_WORKING_VFORK
449 sigset_t procmask;
450 sigset_t blocked;
451 struct sigaction sigpipe_action;
452#endif
448 453
449#if 0 /* Some systems don't have sigblock. */ 454#if 0 /* Some systems don't have sigblock. */
450 mask = sigblock (sigmask (SIGCHLD)); 455 mask = sigblock (sigmask (SIGCHLD));
@@ -525,6 +530,18 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
525 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 530 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
526 0, current_dir); 531 0, current_dir);
527#else /* not WINDOWSNT */ 532#else /* not WINDOWSNT */
533
534#ifdef HAVE_WORKING_VFORK
535 /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
536 this sets the parent's signal handlers as well as the child's.
537 So delay all interrupts whose handlers the child might munge,
538 and record the current handlers so they can be restored later. */
539 sigemptyset (&blocked);
540 sigaddset (&blocked, SIGPIPE);
541 sigaction (SIGPIPE, 0, &sigpipe_action);
542 sigprocmask (SIG_BLOCK, &blocked, &procmask);
543#endif
544
528 BLOCK_INPUT; 545 BLOCK_INPUT;
529 546
530 pid = vfork (); 547 pid = vfork ();
@@ -541,11 +558,26 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
541#else 558#else
542 setpgrp (pid, pid); 559 setpgrp (pid, pid);
543#endif /* USG */ 560#endif /* USG */
561
562 /* GTK causes us to ignore SIGPIPE, make sure it is restored
563 in the child. */
564 signal (SIGPIPE, SIG_DFL);
565#ifdef HAVE_WORKING_VFORK
566 sigprocmask (SIG_SETMASK, &procmask, 0);
567#endif
568
544 child_setup (filefd, fd1, fd_error, (char **) new_argv, 569 child_setup (filefd, fd1, fd_error, (char **) new_argv,
545 0, current_dir); 570 0, current_dir);
546 } 571 }
547 572
548 UNBLOCK_INPUT; 573 UNBLOCK_INPUT;
574
575#ifdef HAVE_WORKING_VFORK
576 /* Restore the signal state. */
577 sigaction (SIGPIPE, &sigpipe_action, 0);
578 sigprocmask (SIG_SETMASK, &procmask, 0);
579#endif
580
549#endif /* not WINDOWSNT */ 581#endif /* not WINDOWSNT */
550 582
551 /* The MSDOS case did this already. */ 583 /* The MSDOS case did this already. */
diff --git a/src/process.c b/src/process.c
index 80e70e49f8e..d026b9d030b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1786,6 +1786,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1786 sigset_t blocked; 1786 sigset_t blocked;
1787 struct sigaction sigint_action; 1787 struct sigaction sigint_action;
1788 struct sigaction sigquit_action; 1788 struct sigaction sigquit_action;
1789 struct sigaction sigpipe_action;
1789#ifdef AIX 1790#ifdef AIX
1790 struct sigaction sighup_action; 1791 struct sigaction sighup_action;
1791#endif 1792#endif
@@ -1898,6 +1899,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1898 and record the current handlers so they can be restored later. */ 1899 and record the current handlers so they can be restored later. */
1899 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action ); 1900 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
1900 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action); 1901 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
1902 sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action);
1901#ifdef AIX 1903#ifdef AIX
1902 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action ); 1904 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
1903#endif 1905#endif
@@ -2054,6 +2056,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2054 2056
2055 signal (SIGINT, SIG_DFL); 2057 signal (SIGINT, SIG_DFL);
2056 signal (SIGQUIT, SIG_DFL); 2058 signal (SIGQUIT, SIG_DFL);
2059 /* GTK causes us to ignore SIGPIPE, make sure it is restored
2060 in the child. */
2061 signal (SIGPIPE, SIG_DFL);
2057 2062
2058 /* Stop blocking signals in the child. */ 2063 /* Stop blocking signals in the child. */
2059 sigprocmask (SIG_SETMASK, &procmask, 0); 2064 sigprocmask (SIG_SETMASK, &procmask, 0);
@@ -2142,6 +2147,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2142 /* Restore the parent's signal handlers. */ 2147 /* Restore the parent's signal handlers. */
2143 sigaction (SIGINT, &sigint_action, 0); 2148 sigaction (SIGINT, &sigint_action, 0);
2144 sigaction (SIGQUIT, &sigquit_action, 0); 2149 sigaction (SIGQUIT, &sigquit_action, 0);
2150 sigaction (SIGPIPE, &sigpipe_action, 0);
2145#ifdef AIX 2151#ifdef AIX
2146 sigaction (SIGHUP, &sighup_action, 0); 2152 sigaction (SIGHUP, &sighup_action, 0);
2147#endif 2153#endif
diff --git a/src/xdisp.c b/src/xdisp.c
index 630c1dcda85..b9b77e34b9d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -444,6 +444,12 @@ static int this_line_pixel_height;
444 444
445static int this_line_start_x; 445static int this_line_start_x;
446 446
447/* The smallest character position seen by move_it_* functions as they
448 move across display lines. Used to set MATRIX_ROW_START_CHARPOS of
449 hscrolled lines, see display_line. */
450
451static struct text_pos this_line_min_pos;
452
447/* Buffer that this_line_.* variables are referring to. */ 453/* Buffer that this_line_.* variables are referring to. */
448 454
449static struct buffer *this_line_buffer; 455static struct buffer *this_line_buffer;
@@ -6909,6 +6915,9 @@ move_it_in_display_line_to (struct it *it,
6909 && it->current_y < it->last_visible_y) 6915 && it->current_y < it->last_visible_y)
6910 handle_line_prefix (it); 6916 handle_line_prefix (it);
6911 6917
6918 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
6919 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
6920
6912 while (1) 6921 while (1)
6913 { 6922 {
6914 int x, i, ascent = 0, descent = 0; 6923 int x, i, ascent = 0, descent = 0;
@@ -7013,6 +7022,9 @@ move_it_in_display_line_to (struct it *it,
7013 if (it->area != TEXT_AREA) 7022 if (it->area != TEXT_AREA)
7014 { 7023 {
7015 set_iterator_to_next (it, 1); 7024 set_iterator_to_next (it, 1);
7025 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7026 SET_TEXT_POS (this_line_min_pos,
7027 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7016 continue; 7028 continue;
7017 } 7029 }
7018 7030
@@ -7121,6 +7133,9 @@ move_it_in_display_line_to (struct it *it,
7121 } 7133 }
7122 7134
7123 set_iterator_to_next (it, 1); 7135 set_iterator_to_next (it, 1);
7136 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7137 SET_TEXT_POS (this_line_min_pos,
7138 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7124 /* On graphical terminals, newlines may 7139 /* On graphical terminals, newlines may
7125 "overflow" into the fringe if 7140 "overflow" into the fringe if
7126 overflow-newline-into-fringe is non-nil. 7141 overflow-newline-into-fringe is non-nil.
@@ -7219,6 +7234,8 @@ move_it_in_display_line_to (struct it *it,
7219 /* The current display element has been consumed. Advance 7234 /* The current display element has been consumed. Advance
7220 to the next. */ 7235 to the next. */
7221 set_iterator_to_next (it, 1); 7236 set_iterator_to_next (it, 1);
7237 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7238 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
7222 7239
7223 /* Stop if lines are truncated and IT's current x-position is 7240 /* Stop if lines are truncated and IT's current x-position is
7224 past the right edge of the window now. */ 7241 past the right edge of the window now. */
@@ -17139,18 +17156,15 @@ find_row_edges (struct it *it, struct glyph_row *row,
17139 if (min_pos <= ZV) 17156 if (min_pos <= ZV)
17140 SET_TEXT_POS (row->minpos, min_pos, min_bpos); 17157 SET_TEXT_POS (row->minpos, min_pos, min_bpos);
17141 else 17158 else
17142 { 17159 /* We didn't find _any_ valid buffer positions in any of the
17143 /* We didn't find _any_ valid buffer positions in any of the 17160 glyphs, so we must trust the iterator's computed positions. */
17144 glyphs, so we must trust the iterator's computed
17145 positions. */
17146 row->minpos = row->start.pos; 17161 row->minpos = row->start.pos;
17162 if (max_pos <= 0)
17163 {
17147 max_pos = CHARPOS (it->current.pos); 17164 max_pos = CHARPOS (it->current.pos);
17148 max_bpos = BYTEPOS (it->current.pos); 17165 max_bpos = BYTEPOS (it->current.pos);
17149 } 17166 }
17150 17167
17151 if (!max_pos)
17152 abort ();
17153
17154 /* Here are the various use-cases for ending the row, and the 17168 /* Here are the various use-cases for ending the row, and the
17155 corresponding values for ROW->maxpos: 17169 corresponding values for ROW->maxpos:
17156 17170
@@ -17263,8 +17277,18 @@ display_line (struct it *it)
17263 if the first glyph is partially visible or if we hit a line end. */ 17277 if the first glyph is partially visible or if we hit a line end. */
17264 if (it->current_x < it->first_visible_x) 17278 if (it->current_x < it->first_visible_x)
17265 { 17279 {
17280 SET_TEXT_POS (this_line_min_pos, ZV + 1, ZV_BYTE + 1);
17266 move_it_in_display_line_to (it, ZV, it->first_visible_x, 17281 move_it_in_display_line_to (it, ZV, it->first_visible_x,
17267 MOVE_TO_POS | MOVE_TO_X); 17282 MOVE_TO_POS | MOVE_TO_X);
17283 /* Record the smallest positions seen while we moved over
17284 display elements that are not visible. This is needed by
17285 redisplay_internal for optimizing the case where the cursor
17286 stays inside the same line. The rest of this function only
17287 considers positions that are actually displayed, so
17288 RECORD_MAX_MIN_POS will not otherwise record positions that
17289 are hscrolled to the left of the left edge of the window. */
17290 min_pos = CHARPOS (this_line_min_pos);
17291 min_bpos = BYTEPOS (this_line_min_pos);
17268 } 17292 }
17269 else 17293 else
17270 { 17294 {