diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 70 | ||||
| -rw-r--r-- | lisp/ChangeLog.16 | 2 | ||||
| -rw-r--r-- | lisp/calendar/todo-mode.el | 19 | ||||
| -rw-r--r-- | lisp/desktop.el | 26 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 16 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/mm-util.el | 2 | ||||
| -rw-r--r-- | lisp/help-fns.el | 2 | ||||
| -rw-r--r-- | lisp/indent.el | 7 | ||||
| -rw-r--r-- | lisp/progmodes/asm-mode.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 76 | ||||
| -rw-r--r-- | lisp/ruler-mode.el | 7 | ||||
| -rw-r--r-- | lisp/textmodes/picture.el | 3 | ||||
| -rw-r--r-- | lisp/url/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 16 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 1 |
17 files changed, 198 insertions, 65 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2ed99cddefb..cd30ff34dce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,61 @@ 2014-06-26 Glenn Morris <rgm@gnu.org> + * emacs-lisp/cl-macs.el (help-add-fundoc-usage): + Remove outdated declaration. + + * emacs-lisp/authors.el (authors-valid-file-names) + (authors-renamed-files-alist): Additions. + +2014-06-26 Leo Liu <sdl.web@gmail.com> + + * textmodes/picture.el (picture-set-tab-stops): + * ruler-mode.el (ruler-mode-mouse-add-tab-stop) + (ruler-mode-ruler): Fix to work with nil tab-stop-list. + + * progmodes/asm-mode.el (asm-calculate-indentation): Use + indent-next-tab-stop. + + * indent.el (indent-accumulate-tab-stops): New function. + +2014-06-26 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625). + (package-desc-status): Obey it. + +2014-06-26 Stephen Berman <stephen.berman@gmx.net> + + * calendar/todo-mode.el: Fix two bugs. + (todo-insert-item--basic): If user cancels item insertion to + another category before setting priority, show original category + whether it is in the same or a different file. + (todo-set-item-priority): After selecting category, instead of + moving point to top, which extends an active region, restore it. + +2014-06-26 Stefan Monnier <monnier@iro.umontreal.ca> + + * help-fns.el (describe-function-1): Check file-name is a string before + calling help-fns--autoloaded-p (bug#17564). + +2014-06-26 Juri Linkov <juri@jurta.org> + + * desktop.el (desktop-auto-save-enable) + (desktop-auto-save-disable): New functions. + (desktop-save-mode, desktop-auto-save-timeout): Use them. + (desktop-read): Disable the autosave before loading the desktop, + and enable afterwards. (Bug#17351) + +2014-06-26 Stefan Monnier <monnier@iro.umontreal.ca> + + Fix some indentation problem with \; and pipes (bug#17842). + * progmodes/sh-script.el (sh-mode-syntax-table): Set syntax of ;|&. + (sh-smie--default-forward-token, sh-smie--default-backward-token): + New functions. + (sh-smie-sh-forward-token, sh-smie-sh-backward-token) + (sh-smie-rc-forward-token, sh-smie-rc-backward-token): Use them. + (sh-smie-sh-rules): Fix indentation of a pipe at BOL. + +2014-06-26 Glenn Morris <rgm@gnu.org> + * emacs-lisp/find-func.el (find-function-C-source-directory): Use file-accessible-directory-p. @@ -12194,7 +12250,7 @@ 2013-07-07 Michael Kifer <kifer@cs.stonybrook.edu> - * ediff.el (ediff-version): Version update. + * vc/ediff.el (ediff-version): Version update. (ediff-files-command, ediff3-files-command, ediff-merge-command) (ediff-merge-with-ancestor-command, ediff-directories-command) (ediff-directories3-command, ediff-merge-directories-command) @@ -12202,19 +12258,21 @@ All are command-line interfaces to ediff: to facilitate calling Emacs with the appropriate ediff functions invoked. - * viper-cmd.el (viper-del-forward-char-in-insert): New function. + * emulation/viper-cmd.el (viper-del-forward-char-in-insert): + New function. (viper-save-kill-buffer): Check if buffer is modified. - * viper.el (viper-version): Version update. + * emulation/viper.el (viper-version): Version update. (viper-emacs-state-mode-list): Add egg-status-buffer-mode. 2013-07-07 Stefan Monnier <monnier@iro.umontreal.ca> * faces.el (tty-run-terminal-initialization): Run new tty-setup-hook. - * viper-cmd.el (viper-envelop-ESC-key): Remove function. + * emulation/viper-cmd.el (viper-envelop-ESC-key): Remove function. (viper-intercept-ESC-key): Simplify. - * viper-keym.el (viper-ESC-key): Make it a constant, don't use kbd. - * viper.el (viper--tty-ESC-filter, viper--lookup-key) + * emulation/viper-keym.el (viper-ESC-key): Make it a constant, + don't use kbd. + * emulation/viper.el (viper--tty-ESC-filter, viper--lookup-key) (viper-catch-tty-ESC, viper-uncatch-tty-ESC) (viper-setup-ESC-to-escape): New functions. (viper-go-away, viper-set-hooks): Call viper-setup-ESC-to-escape. diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16 index 534f91f61ce..2e8c6df24a6 100644 --- a/lisp/ChangeLog.16 +++ b/lisp/ChangeLog.16 @@ -8501,7 +8501,7 @@ 2012-07-25 Jay Belanger <jay.p.belanger@gmail.com> - * calc-alg.el (math-simplify-divide): Don't cross multiply + * calc/calc-alg.el (math-simplify-divide): Don't cross multiply in an equation when the lhs is a variable. 2012-07-24 Julien Danjou <julien@danjou.info> diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index ab2ab3e4cb8..1a54cc2c67b 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -1962,13 +1962,12 @@ their associated keys and their effects." ;; If user cancels before setting priority, restore ;; display. (unless item-added - (if ocat - (progn - (unless (equal cat ocat) - (todo-category-number ocat) - (todo-category-select)) - (and done-only (todo-toggle-view-done-only))) - (set-window-buffer (selected-window) (set-buffer obuf))) + (set-window-buffer (selected-window) (set-buffer obuf)) + (when ocat + (unless (equal cat ocat) + (todo-category-number ocat) + (todo-category-select)) + (and done-only (todo-toggle-view-done-only))) (goto-char opoint)) ;; If the todo items section is not visible when the ;; insertion command is called (either because only done @@ -2553,9 +2552,9 @@ meaning to raise or lower the item's priority by one." (goto-char (point-min)) (setq done (re-search-forward todo-done-string-start nil t)))) (let ((todo-show-with-done done)) - (todo-category-select) - ;; Keep top of category in view while setting priority. - (goto-char (point-min))))) + ;; Keep current item or top of moved to category in view + ;; while setting priority. + (save-excursion (todo-category-select))))) ;; Prompt for priority only when the category has at least one ;; todo item. (when (> maxnum 1) diff --git a/lisp/desktop.el b/lisp/desktop.el index d420a6416a9..26d288bf9cd 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -174,11 +174,8 @@ For further details, see info node `(emacs)Saving Emacs Sessions'." :global t :group 'desktop (if desktop-save-mode - (when (and (integerp desktop-auto-save-timeout) - (> desktop-auto-save-timeout 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer))) + (desktop-auto-save-enable) + (desktop-auto-save-disable))) (defun desktop-save-mode-off () "Disable `desktop-save-mode'. Provided for use in hooks." @@ -219,9 +216,8 @@ Zero or nil means disable auto-saving due to idleness." (set-default symbol value) (ignore-errors (if (and (integerp value) (> value 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer)))) + (desktop-auto-save-enable value) + (desktop-auto-save-disable)))) :group 'desktop :version "24.4") @@ -1132,6 +1128,10 @@ Using it may cause conflicts. Use it anyway? " owner))))) (unless desktop-dirname (message "Desktop file in use; not loaded."))) (desktop-lazy-abort) + ;; Temporarily disable the autosave that will leave it + ;; disabled when loading the desktop fails with errors, + ;; thus not overwriting the desktop with broken contents. + (desktop-auto-save-disable) ;; Evaluate desktop buffer and remember when it was modified. (load (desktop-full-file-name) t t t) (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) @@ -1184,6 +1184,7 @@ Using it may cause conflicts. Use it anyway? " owner))))) (set-window-prev-buffers window nil) (set-window-next-buffers window nil)))) (setq desktop-saved-frameset nil) + (desktop-auto-save-enable) t)) ;; No desktop file found. (desktop-clear) @@ -1230,6 +1231,15 @@ directory DIRNAME." ;; Auto-Saving. (defvar desktop-auto-save-timer nil) +(defun desktop-auto-save-enable (&optional timeout) + (when (and (integerp (or timeout desktop-auto-save-timeout)) + (> (or timeout desktop-auto-save-timeout) 0)) + (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer))) + +(defun desktop-auto-save-disable () + (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) + (desktop-auto-save-cancel-timer)) + (defun desktop-auto-save () "Save the desktop periodically. Called by the timer created in `desktop-auto-save-set-timer'." diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index ce54337a3b1..0a426d17096 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -382,8 +382,6 @@ its argument list allows full Common Lisp conventions." (if (car res) `(progn ,(car res) ,form) form)) `(function ,func))) -(declare-function help-add-fundoc-usage "help-fns" (docstring arglist)) - (defun cl--make-usage-var (x) "X can be a var or a (destructuring) lambda-list." (cond diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 7ca62464bd0..c2aaabdd6a6 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -836,6 +836,8 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'." sig)) (epg-context-result-for context 'verify))))) (if (null good-signatures) + ;; FIXME: Only signal an error if the signature is invalid, not if we + ;; simply lack the key needed to check the sig! (error "Failed to verify signature %s: %S" sig-file (mapcar #'epg-signature-to-string @@ -1664,6 +1666,9 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (defvar package-list-unversioned nil "If non-nil include packages that don't have a version in `list-package'.") +(defvar package-list-unsigned nil + "If non-nil, mention in the list which packages were installed w/o signature.") + (defun package-desc-status (pkg-desc) (let* ((name (package-desc-name pkg-desc)) (dir (package-desc-dir pkg-desc)) @@ -1684,9 +1689,8 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (dir ;One of the installed packages. (cond ((not (file-exists-p (package-desc-dir pkg-desc))) "deleted") - ((eq pkg-desc (cadr (assq name package-alist))) (if signed - "installed" - "unsigned")) + ((eq pkg-desc (cadr (assq name package-alist))) + (if (or (not package-list-unsigned) signed) "installed" "unsigned")) (t "obsolete"))) (t (let* ((ins (cadr (assq name package-alist))) @@ -1696,9 +1700,9 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (if (memq name package-menu--new-package-list) "new" "available")) ((version-list-< version ins-v) "obsolete") - ((version-list-= version ins-v) (if signed - "installed" - "unsigned")))))))) + ((version-list-= version ins-v) + (if (or (not package-list-unsigned) signed) + "installed" "unsigned")))))))) (defun package-menu--refresh (&optional packages keywords) "Re-populate the `tabulated-list-entries'. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 68cbe14ecc8..7589d1505d7 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2014-06-26 Glenn Morris <rgm@gnu.org> + + * mm-util.el (help-function-arglist): Remove outdated declaration. + 2014-06-24 Andreas Schwab <schwab@linux-m68k.org> * html2text.el (html2text-get-attr): Rewrite to handle spaces in quoted diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 0d02e1db758..31b7d073fbe 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -1374,8 +1374,6 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." (write-region start end filename append visit lockname))) (autoload 'gmm-write-region "gmm-utils") -(declare-function help-function-arglist "help-fns" - (def &optional preserve-names)) ;; It is not a MIME function, but some MIME functions use it. (if (and (fboundp 'make-temp-file) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 25ee1d3149f..248e505ad79 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -483,7 +483,7 @@ FILE is the file where FUNCTION was probably defined." (beg (if (and (or (byte-code-function-p def) (keymapp def) (memq (car-safe def) '(macro lambda closure))) - file-name + (stringp file-name) (help-fns--autoloaded-p function file-name)) (if (commandp def) "an interactive autoloaded " diff --git a/lisp/indent.el b/lisp/indent.el index 7df927ff808..20820701b3b 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead." (if (<= column last) -1 (/ (- column last 1) step)) (1+ (/ (- column last) step))))))))) +(defun indent-accumulate-tab-stops (limit) + "Get a list of tab stops before LIMIT (inclusive)." + (let ((tab 0) (tab-stops)) + (while (<= (setq tab (indent-next-tab-stop tab)) limit) + (push tab tab-stops)) + (nreverse tab-stops))) + (defun tab-to-tab-stop () "Insert spaces or tabs to next defined tab-stop column. The variable `tab-stop-list' is a list of columns at which there are tab stops. diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index ab7612082d5..3532b4a03f1 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -172,7 +172,7 @@ Special commands: ;; Simple `;' comments go to the comment-column. (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column) ;; The rest goes at the first tab stop. - (or (car tab-stop-list) tab-width))) + (or (indent-next-tab-stop 0)))) (defun asm-colon () "Insert a colon; if it follows a label, delete the label's indentation." diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index c3032b4f195..eb6a55689c1 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -481,6 +481,9 @@ name symbol." ?~ "_" ?, "_" ?= "." + ?\; "." + ?| "." + ?& "." ?< "." ?> ".") "The syntax table to use for Shell-Script mode. @@ -1860,6 +1863,40 @@ Does not preserve point." ((equal tok "in") (sh-smie--sh-keyword-in-p)) (t (sh-smie--keyword-p)))) +(defun sh-smie--default-forward-token () + (forward-comment (point-max)) + (buffer-substring-no-properties + (point) + (progn (if (zerop (skip-syntax-forward ".")) + (while (progn (skip-syntax-forward "w_'") + (looking-at "\\\\")) + (forward-char 2))) + (point)))) + +(defun sh-smie--default-backward-token () + (forward-comment (- (point))) + (let ((pos (point)) + (n (skip-syntax-backward "."))) + (if (or (zerop n) + (and (eq n -1) + (let ((p (point))) + (if (eq -1 (% (skip-syntax-backward "\\") 2)) + t + (goto-char p) + nil)))) + (while + (progn (skip-syntax-backward "w_'") + (or (not (zerop (skip-syntax-backward "\\"))) + (when (eq ?\\ (char-before (1- (point)))) + (let ((p (point))) + (forward-char -1) + (if (eq -1 (% (skip-syntax-backward "\\") 2)) + t + (goto-char p) + nil)))))) + (goto-char (- (point) (% (skip-syntax-backward "\\") 2)))) + (buffer-substring-no-properties (point) pos))) + (defun sh-smie-sh-forward-token () (if (and (looking-at "[ \t]*\\(?:#\\|\\(\\s|\\)\\|$\\)") (save-excursion @@ -1888,7 +1925,7 @@ Does not preserve point." tok)) (t (let* ((pos (point)) - (tok (smie-default-forward-token))) + (tok (sh-smie--default-forward-token))) (cond ((equal tok ")") "case-)") ((equal tok "(") "case-(") @@ -1932,7 +1969,7 @@ Does not preserve point." (goto-char (match-beginning 1)) (match-string-no-properties 1)) (t - (let ((tok (smie-default-backward-token))) + (let ((tok (sh-smie--default-backward-token))) (cond ((equal tok ")") "case-)") ((equal tok "(") "case-(") @@ -1962,18 +1999,18 @@ May return nil if the line should not be treated as continued." (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) (sh-var-value 'sh-indent-for-case-label))) ((and `(:before . ,_) - (guard (when sh-indent-after-continuation - (save-excursion - (ignore-errors - (skip-chars-backward " \t") - (sh-smie--looking-back-at-continuation-p)))))) - ;; After a line-continuation, make sure the rest is indented. - (let* ((sh-indent-after-continuation nil) - (indent (smie-indent-calculate)) - (initial (sh-smie--continuation-start-indent))) - (when (and (numberp indent) (numberp initial) - (<= indent initial)) - `(column . ,(+ initial sh-indentation))))) + ;; After a line-continuation, make sure the rest is indented. + (guard sh-indent-after-continuation) + (guard (save-excursion + (ignore-errors + (skip-chars-backward " \t") + (sh-smie--looking-back-at-continuation-p)))) + (let initial (sh-smie--continuation-start-indent)) + (guard (let* ((sh-indent-after-continuation nil) + (indent (smie-indent-calculate))) + (and (numberp indent) (numberp initial) + (<= indent initial))))) + `(column . ,(+ initial sh-indentation))) (`(:before . ,(or `"(" `"{" `"[")) (when (smie-rule-hanging-p) (if (not (smie-rule-prev-p "&&" "||" "|")) @@ -1997,7 +2034,12 @@ May return nil if the line should not be treated as continued." (smie-rule-bolp)))) (current-column) (smie-indent-calculate))))) - (`(:after . ,(or `"|" `"&&" `"||")) (if (smie-rule-parent-p token) nil 4)) + (`(:before . ,(or `"|" `"&&" `"||")) + (unless (smie-rule-parent-p token) + (smie-backward-sexp token) + `(column . ,(+ (funcall smie-rules-function :elem 'basic) + (smie-indent-virtual))))) + ;; Attempt at backward compatibility with the old config variables. (`(:before . "fi") (sh-var-value 'sh-indent-for-fi)) (`(:before . "done") (sh-var-value 'sh-indent-for-done)) @@ -2118,7 +2160,7 @@ Point should be before the newline." ;; tok)) (t (let* ((pos (point)) - (tok (smie-default-forward-token))) + (tok (sh-smie--default-forward-token))) (cond ;; ((equal tok ")") "case-)") ((and tok (string-match "\\`[a-z]" tok) @@ -2159,7 +2201,7 @@ Point should be before the newline." ;; (goto-char (match-beginning 1)) ;; (match-string-no-properties 1)) (t - (let ((tok (smie-default-backward-token))) + (let ((tok (sh-smie--default-backward-token))) (cond ;; ((equal tok ")") "case-)") ((and tok (string-match "\\`[a-z]" tok) diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 238754e8584..de31f2ec4ae 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -476,8 +476,9 @@ START-EVENT is the mouse click event." (not (member ts tab-stop-list)) (progn (message "Tab stop set to %d" ts) - (setq tab-stop-list (sort (cons ts tab-stop-list) - #'<))))))))) + (when (null tab-stop-list) + (setq tab-stop-list (indent-accumulate-tab-stops (1- ts)))) + (setq tab-stop-list (sort (cons ts tab-stop-list) #'<))))))))) (defun ruler-mode-mouse-del-tab-stop (start-event) "Delete tab stop at the graduation where the mouse pointer is on. @@ -753,7 +754,7 @@ Optional argument PROPS specifies other text properties to apply." i (1+ i) 'help-echo ruler-mode-fill-column-help-echo ruler)) ;; Show the `tab-stop-list' markers. - ((and ruler-mode-show-tab-stops (member j tab-stop-list)) + ((and ruler-mode-show-tab-stops (= j (indent-next-tab-stop (1- j)))) (aset ruler i ruler-mode-tab-stop-char) (put-text-property i (1+ i) 'face 'ruler-mode-tab-stop diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index b11b773dee1..94d02bebb6a 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop." (save-excursion (let (tabs) (if arg - (setq tabs (default-value 'tab-stop-list)) + (setq tabs (or (default-value 'tab-stop-list) + (indent-accumulate-tab-stops (window-width)))) (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]"))) (beginning-of-line) (let ((bol (point))) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index b445ff6d1f1..b8e34ea65c4 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,11 @@ +2014-06-26 Leo Liu <sdl.web@gmail.com> + + * url-http.el (url-http-end-of-headers): Remove duplicate defvar. + + * url-handlers.el (url-http-parse-response): Remove unused autoload. + (url-insert-file-contents): Condition on url-http-response-status + for the HTTP/S specific part. (Bug#17549) + 2014-05-14 Glenn Morris <rgm@gnu.org> * url-util.el (url-make-private-file): Use with-file-modes. diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index c86acb680d0..704c743bfcd 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -33,7 +33,6 @@ (autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.") (autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.") (autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.") -(autoload 'url-http-parse-response "url-http" "Parse just the response code.") ;; Always used after mm-dissect-buffer and defined in the same file. (declare-function mm-save-part-to-file "mm-decode" (handle file)) @@ -308,17 +307,21 @@ They count bytes from the beginning of the body." (insert data)) (list (length data) charset))) +(defvar url-http-codes) + ;;;###autoload (defun url-insert-file-contents (url &optional visit beg end replace) (let ((buffer (url-retrieve-synchronously url))) (unless buffer (signal 'file-error (list url "No Data"))) (with-current-buffer buffer - (let ((response (url-http-parse-response))) - (if (and (>= response 200) (< response 300)) - (goto-char (point-min)) - (let ((desc (buffer-substring-no-properties (1+ (point)) - (line-end-position)))) + ;; XXX: This is HTTP/S specific and should be moved to url-http + ;; instead. See http://debbugs.gnu.org/17549. + (when (bound-and-true-p url-http-response-status) + (unless (and (>= url-http-response-status 200) + (< url-http-response-status 300)) + (let ((desc (nth 2 (assq url-http-response-status url-http-codes)))) (kill-buffer buffer) + ;; Signal file-error per http://debbugs.gnu.org/16733. (signal 'file-error (list url desc)))))) (if visit (setq buffer-file-name url)) (save-excursion @@ -333,6 +336,7 @@ They count bytes from the beginning of the body." ;; usual heuristic/rules that we apply to files. (decode-coding-inserted-region start (point) url visit beg end replace)) (list url (car size-and-charset)))))) + (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) (defun url-file-name-completion (url directory &optional predicate) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 23e7d4b6074..608a865be7b 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -48,7 +48,6 @@ (defvar url-http-response-version) (defvar url-http-target-url) (defvar url-http-transfer-encoding) -(defvar url-http-end-of-headers) (defvar url-show-status) (require 'url-gw) |
