emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 92cf4bb 2/2: Merge remote-tracking branch 'savannah/


From: Andrea Corallo
Subject: feature/native-comp 92cf4bb 2/2: Merge remote-tracking branch 'savannah/master' into HEAD
Date: Wed, 6 May 2020 16:01:21 -0400 (EDT)

branch: feature/native-comp
commit 92cf4bb8cc3da81f4877a734b9e9089ac4b89e85
Merge: f8df332 02f5a41
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Merge remote-tracking branch 'savannah/master' into HEAD
---
 doc/emacs/help.texi          |  52 +++++++++++---------
 doc/emacs/misc.texi          |  13 +++--
 doc/emacs/modes.texi         |   2 +-
 doc/lispref/frames.texi      |  10 ++--
 etc/NEWS                     |  16 ++++++
 lisp/dnd.el                  |  34 +++++++------
 lisp/fileloop.el             |  33 +++++++++----
 lisp/gnus/message.el         |   4 +-
 lisp/help-fns.el             |   8 +--
 lisp/net/browse-url.el       | 114 +++++++++++++++++++++++++++++--------------
 lisp/net/eww.el              |   4 ++
 lisp/net/tramp-adb.el        |  26 +++++-----
 lisp/net/tramp-sh.el         |  23 +++++----
 lisp/textmodes/sgml-mode.el  |   6 +--
 src/bignum.h                 |   3 +-
 src/conf_post.h              |   9 ++--
 src/data.c                   |  20 ++++++--
 src/editfns.c                |   2 +-
 src/emacs-module.c           |   2 +-
 test/lisp/net/tramp-tests.el |   1 +
 20 files changed, 250 insertions(+), 132 deletions(-)

diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 49c53c5..167c32c 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -89,91 +89,97 @@ following sections.
 @table @kbd
 @item C-h a @var{topics} @key{RET}
 Display a list of commands whose names match @var{topics}
-(@code{apropos-command}).
+(@code{apropos-command}).  @xref{Apropos}.
 @item C-h b
 Display all active key bindings; minor mode bindings first, then those
 of the major mode, then global bindings (@code{describe-bindings}).
+@xref{Misc Help}.
 @item C-h c @var{key}
 Show the name of the command that the key sequence @var{key} is bound
 to (@code{describe-key-briefly}).  Here @kbd{c} stands for
 ``character''.  For more extensive information on @var{key}, use
-@kbd{C-h k}.
+@kbd{C-h k}.  @xref{Key Help}.
 @item C-h d @var{topics} @key{RET}
 Display the commands and variables whose documentation matches
-@var{topics} (@code{apropos-documentation}).
+@var{topics} (@code{apropos-documentation}).  @xref{Apropos}.
 @item C-h e
 Display the @file{*Messages*} buffer
-(@code{view-echo-area-messages}).
+(@code{view-echo-area-messages}).  @xref{Misc Help}.
 @item C-h f @var{function} @key{RET}
 Display documentation on the Lisp function named @var{function}
 (@code{describe-function}).  Since commands are Lisp functions,
-this works for commands too.
+this works for commands too.  @xref{Name Help}.
 @item C-h h
 Display the @file{HELLO} file, which shows examples of various character
 sets.
 @item C-h i
 Run Info, the GNU documentation browser (@code{info}).  The Emacs
-manual is available in Info.
+manual is available in Info.  @xref{Misc Help}.
 @item C-h k @var{key}
 Display the name and documentation of the command that @var{key} runs
-(@code{describe-key}).
+(@code{describe-key}).  @xref{Key Help}.
 @item C-h l
 Display a description of your last 300 keystrokes
-(@code{view-lossage}).
+(@code{view-lossage}).  @xref{Misc Help}.
 @item C-h m
 Display documentation of the current major mode and minor modes
-(@code{describe-mode}).
+(@code{describe-mode}).  @xref{Misc Help}.
 @item C-h n
 Display news of recent Emacs changes (@code{view-emacs-news}).
+@xref{Help Files}.
 @item C-h o @var{symbol}
 Display documentation of the Lisp symbol named @var{symbol}
 (@code{describe-symbol}).  This will show the documentation of all
-kinds of symbols: functions, variables, and faces.
+kinds of symbols: functions, variables, and faces.  @xref{Name Help}.
 @item C-h p
-Find packages by topic keyword (@code{finder-by-keyword}).  This lists
-packages using a package menu buffer.  @xref{Packages}.
+Find packages by topic keyword (@code{finder-by-keyword}).
+@xref{Package Keywords}.  This lists packages using a package menu
+buffer.  @xref{Packages}.
 @item C-h P @var{package} @key{RET}
 Display documentation about the specified package
-(@code{describe-package}).
+(@code{describe-package}).  @xref{Package Keywords}.
 @item C-h r
 Display the Emacs manual in Info (@code{info-emacs-manual}).
 @item C-h s
 Display the contents of the current @dfn{syntax table}
-(@code{describe-syntax}).  The syntax table says which characters are
-opening delimiters, which are parts of words, and so on.  @xref{Syntax
-Tables,, Syntax Tables, elisp, The Emacs Lisp Reference Manual}, for
-details.
+(@code{describe-syntax}).  @xref{Misc Help}.  The syntax table says
+which characters are opening delimiters, which are parts of words, and
+so on.  @xref{Syntax Tables,, Syntax Tables, elisp, The Emacs Lisp
+Reference Manual}, for details.
 @item C-h t
 Enter the Emacs interactive tutorial (@code{help-with-tutorial}).
 @item C-h v @var{var} @key{RET}
 Display the documentation of the Lisp variable @var{var}
-(@code{describe-variable}).
+(@code{describe-variable}).  @xref{Name Help}.
 @item C-h w @var{command} @key{RET}
 Show which keys run the command named @var{command} (@code{where-is}).
+@xref{Key Help}.
 @item C-h C @var{coding} @key{RET}
 Describe the coding system @var{coding}
-(@code{describe-coding-system}).
+(@code{describe-coding-system}).  @xref{Coding Systems}.
 @item C-h C @key{RET}
 Describe the coding systems currently in use.
 @item C-h F @var{command} @key{RET}
 Enter Info and go to the node that documents the Emacs command
-@var{command} (@code{Info-goto-emacs-command-node}).
+@var{command} (@code{Info-goto-emacs-command-node}).  @xref{Name Help}.
 @item C-h I @var{method} @key{RET}
 Describe the input method @var{method} (@code{describe-input-method}).
+@xref{Select Input Method}.
 @item C-h K @var{key}
 Enter Info and go to the node that documents the key sequence
-@var{key} (@code{Info-goto-emacs-key-command-node}).
+@var{key} (@code{Info-goto-emacs-key-command-node}).  @xref{Key Help}.
 @item C-h L @var{language-env} @key{RET}
 Display information on the character sets, coding systems, and input
 methods used in language environment @var{language-env}
-(@code{describe-language-environment}).
+(@code{describe-language-environment}).  @xref{Language Environments}.
 @item C-h S @var{symbol} @key{RET}
 Display the Info documentation on symbol @var{symbol} according to the
 programming language you are editing (@code{info-lookup-symbol}).
+@xref{Misc Help}.
 @item C-h .
 Display the help message for a special text area, if point is in one
 (@code{display-local-help}).  (These include, for example, links in
-@file{*Help*} buffers.)
+@file{*Help*} buffers.)  @xref{Help Echo}.
 @end table
 
 @node Key Help
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 47f195d..d1854f3 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2920,9 +2920,16 @@ you might like to bind to keys, such as 
@code{browse-url-at-point} and
   You can customize Browse-URL's behavior via various options in the
 @code{browse-url} Customize group.  In particular, the option
 @code{browse-url-mailto-function} lets you define how to follow
-@samp{mailto:} URLs, while @code{browse-url-browser-function} lets you
-define how to follow other types of URLs.  For more information, view
-the package commentary by typing @kbd{C-h P browse-url @key{RET}}.
+@samp{mailto:} URLs, while @code{browse-url-browser-function}
+specifies your default browser.
+
+@vindex browse-url-handlers
+  You can define that certain URLs are browsed with other functions by
+customizing @code{browse-url-handlers}, an alist of regular
+expressions paired with functions to browse matching URLs.
+
+For more information, view the package commentary by typing @kbd{C-h P
+browse-url @key{RET}}.
 
 @node Goto Address mode
 @subsection Activating URLs
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index f5fb6b1..c1420ea 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -116,7 +116,7 @@ is enabled in a buffer.  @xref{Hooks}, for more information 
about
 hooks.  Each mode hook is named after its major mode, e.g., Fortran
 mode has @code{fortran-mode-hook}.  Furthermore, all text-based major
 modes run @code{text-mode-hook}, and many programming language modes
-@footnote{More specifically, the modes which are ''derived'' from
+@footnote{More specifically, the modes which are ``derived'' from
 @code{prog-mode} (@pxref{Derived Modes,,, elisp, The Emacs Lisp
 Reference Manual}).} (including all those distributed with Emacs) run
 @code{prog-mode-hook}, prior to running their own mode hooks.  Hook
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 905e5c2..6bf5db2 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -3875,13 +3875,15 @@ detailed knowledge of what types other applications use 
for drag and
 drop.
 
 @vindex dnd-protocol-alist
+@vindex browse-url-handlers
+@vindex browse-url-default-handlers
   When an URL is dropped on Emacs it may be a file, but it may also be
 another URL type (https, etc.).  Emacs first checks
 @code{dnd-protocol-alist} to determine what to do with the URL@.  If
-there is no match there and if @code{browse-url-browser-function} is
-an alist, Emacs looks for a match there.  If no match is found the
-text for the URL is inserted.  If you want to alter Emacs behavior,
-you can customize these variables.
+there is no match there, Emacs looks for a match in
+@code{browse-url-handlers} and @code{browse-url-default-handlers}.  If
+still no match has been found, the text for the URL is inserted.  If
+you want to alter Emacs behavior, you can customize these variables.
 
 @node Color Names
 @section Color Names
diff --git a/etc/NEWS b/etc/NEWS
index 0f4b624..ac93a76 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -304,6 +304,22 @@ use ‘doxygen’ by default one might evaluate:
                     (c++-mode  . doxygen)))
 
 or use it in a custom ‘c-style’.
+
+** browse-url
+
+*** Added support for custom URL handlers
+
+There is a new defvar 'browse-url-default-handlers' and a defcustom
+'browse-url-handlers' being alists with (REGEXP . FUNCTION) entries
+allowing to define different browsing FUNCTIONs depending on the URL
+to be browsed.  The defvar is for default handlers provided by Emacs
+itself or external packages, the defcustom is for the user (and allows
+for overriding the default handlers).
+
+Formerly, one could do the same by setting
+'browse-url-browser-function' to such an alist.  This usage is still
+supported but deprecated.
+
 
 * New Modes and Packages in Emacs 28.1
 
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 905659e..2f7b16c 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -87,12 +87,11 @@ and is the default except for MS-Windows."
 (defun dnd-handle-one-url (window action url)
   "Handle one dropped url by calling the appropriate handler.
 The handler is first located by looking at `dnd-protocol-alist'.
-If no match is found here, and the value of `browse-url-browser-function'
-is a pair of (REGEXP . FUNCTION), those regexps are tried for a match.
-If no match is found, just call `dnd-insert-text'.
-WINDOW is where the drop happened, ACTION is the action for the drop,
-URL is what has been dropped.
-Returns ACTION."
+If no match is found here, `browse-url-handlers' and
+`browse-url-default-handlers' are searched for a match.
+If no match is found, just call `dnd-insert-text'.  WINDOW is
+where the drop happened, ACTION is the action for the drop, URL
+is what has been dropped.  Returns ACTION."
   (require 'browse-url)
   (let (ret)
     (or
@@ -102,14 +101,21 @@ Returns ACTION."
           (setq ret (funcall (cdr bf) url action))
           (throw 'done t)))
        nil)
-     (when (not (functionp browse-url-browser-function))
-       (catch 'done
-        (dolist (bf browse-url-browser-function)
-          (when (string-match (car bf) url)
-            (setq ret 'private)
-            (funcall (cdr bf) url action)
-            (throw 'done t)))
-        nil))
+     (catch 'done
+       (require 'browse-url) ;; browse-url-handlers is not autoloaded.
+       (dolist (bf (append
+                    ;; The alist choice of browse-url-browser-function
+                    ;; is deprecated since 28.1, so the (unless ...)
+                    ;; can be removed at some point in time.
+                    (unless (functionp browse-url-browser-function)
+                      browse-url-browser-function)
+                    browse-url-handlers
+                    browse-url-default-handlers))
+        (when (string-match (car bf) url)
+          (setq ret 'private)
+          (funcall (cdr bf) url action)
+          (throw 'done t)))
+       nil)
      (progn
        (dnd-insert-text window action url)
        (setq ret 'private)))
diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index 8f49116..d52e35d 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -181,8 +181,7 @@ operating on the next file and nil otherwise."
     (fileloop-initialize
      files
      (lambda ()
-       (let ((case-fold-search
-              (if (memq case-fold '(t nil)) case-fold case-fold-search)))
+       (let ((case-fold-search (fileloop--case-fold regexp case-fold)))
          (re-search-forward regexp nil t)))
      (lambda ()
        (unless (eq last-buffer (current-buffer))
@@ -190,13 +189,27 @@ operating on the next file and nil otherwise."
          (message "Scanning file %s...found" buffer-file-name))
        nil))))
 
+(defun fileloop--case-fold (regexp case-fold)
+  (let ((value
+         (if (memql case-fold '(nil t))
+             case-fold
+           case-fold-search)))
+    (if (and value search-upper-case)
+        (isearch-no-upper-case-p regexp t)
+      value)))
+
 ;;;###autoload
 (defun fileloop-initialize-replace (from to files case-fold &optional 
delimited)
   "Initialize a new round of query&replace on several files.
 FROM is a regexp and TO is the replacement to use.
-FILES describes the file, as in `fileloop-initialize'.
-CASE-FOLD can be t, nil, or `default', the latter one meaning to obey
-the default setting of `case-fold-search'.
+FILES describes the files, as in `fileloop-initialize'.
+CASE-FOLD can be t, nil, or `default':
+  if it is nil, matching of FROM is case-sensitive.
+  if it is t, matching of FROM is case-insensitive, except
+     when `search-upper-case' is non-nil and FROM includes
+     upper-case letters.
+  if it is `default', the function uses the value of
+     `case-fold-search' instead.
 DELIMITED if non-nil means replace only word-delimited matches."
   ;; FIXME: Not sure how the delimited-flag interacts with the regexp-flag in
   ;; `perform-replace', so I just try to mimic the old code.
@@ -204,8 +217,7 @@ DELIMITED if non-nil means replace only word-delimited 
matches."
     (fileloop-initialize
      files
      (lambda ()
-       (let ((case-fold-search
-              (if (memql case-fold '(nil t)) case-fold case-fold-search)))
+       (let ((case-fold-search (fileloop--case-fold from case-fold)))
          (when (re-search-forward from nil t)
            ;; When we find a match, save its beginning for
            ;; `perform-replace' (we used to just set point, but this
@@ -213,9 +225,10 @@ DELIMITED if non-nil means replace only word-delimited 
matches."
            ;; `switch-to-buffer-preserve-window-point').
            (puthash (current-buffer) (match-beginning 0) mstart))))
      (lambda ()
-       (perform-replace from to t t delimited nil multi-query-replace-map
-                        (gethash (current-buffer) mstart (point-min))
-                        (point-max))))))
+       (let ((case-fold-search (fileloop--case-fold from case-fold)))
+         (perform-replace from to t t delimited nil multi-query-replace-map
+                          (gethash (current-buffer) mstart (point-min))
+                          (point-max)))))))
 
 (provide 'fileloop)
 ;;; fileloop.el ends here
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index eb9c79d..8f402bf 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -873,8 +873,8 @@ If this is nil, use `user-mail-address'.  If it is the 
symbol
     message-sendmail-envelope-from))
 
 (defcustom message-sendmail-extra-arguments nil
-  "Additional arguments to `sendmail-program'."
-  ;; E.g. '("-a" "account") for msmtp
+  "Additional arguments to `sendmail-program'.
+A list of strings, e.g. (\"-a\" \"account\") for msmtp."
   :version "23.1" ;; No Gnus
   :type '(repeat string)
   ;; :link '(custom-manual "(message)Mail Variables")
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index f9f25d4..f2495d0 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -902,7 +902,7 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
        (output nil))
     (if custom-version
        (setq output
-             (format "This %s was introduced, or its default value was 
changed, in\nversion %s of Emacs.\n"
+             (format "  This %s was introduced, or its default value was 
changed, in\n  version %s of Emacs.\n"
                       type custom-version))
       (when cpv
        (let* ((package (car-safe cpv))
@@ -913,7 +913,7 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
               (emacsv (cdr (assoc version pkg-versions))))
          (if (and package version)
              (setq output
-                   (format (concat "This %s was introduced, or its default 
value was changed, in\nversion %s of the %s package"
+                   (format (concat "  This %s was introduced, or its default 
value was changed, in\n  version %s of the %s package"
                                    (if emacsv
                                        (format " that is part of Emacs %s" 
emacsv))
                                    ".\n")
@@ -1134,8 +1134,8 @@ it is displayed along with the global value."
     ;; Note variable's version or package version.
     (let ((output (describe-variable-custom-version-info variable)))
       (when output
-       (terpri)
-       (terpri)
+       ;; (terpri)
+       ;; (terpri)
        (princ output)))))
 
 (add-hook 'help-fns-describe-variable-functions #'help-fns--var-safe-local)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 7aad44b..1275c15 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -114,9 +114,10 @@
 ;; To always save modified buffers before displaying the file in a browser:
 ;;     (setq browse-url-save-file t)
 
-;; To invoke different browsers for different URLs:
-;;      (setq browse-url-browser-function '(("^mailto:"; . browse-url-mail)
-;;                                         ("." . browse-url-firefox)))
+;; To invoke different browsers/tools for different URLs, customize
+;; `browse-url-handlers'.  In earlier versions of Emacs, the same
+;; could be done by setting `browse-url-browser-function' to an alist
+;; but this usage is deprecated now.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Code:
@@ -157,7 +158,9 @@
                   :value browse-url-default-browser)
     (function :tag "Your own function")
     (alist :tag "Regexp/function association list"
-          :key-type regexp :value-type function)))
+          :key-type regexp :value-type function
+           :format "%{%t%}\n%d%v\n"
+           :doc "Deprecated.  Use `browse-url-handlers' instead.")))
 
 ;;;###autoload
 (defcustom browse-url-browser-function 'browse-url-default-browser
@@ -165,13 +168,8 @@
 This is used by the `browse-url-at-point', `browse-url-at-mouse', and
 `browse-url-of-file' commands.
 
-If the value is not a function it should be a list of pairs
-\(REGEXP . FUNCTION).  In this case the function called will be the one
-associated with the first REGEXP which matches the current URL.  The
-function is passed the URL and any other args of `browse-url'.  The last
-regexp should probably be \".\" to specify a default browser.
-
-Also see `browse-url-secondary-browser-function'."
+Also see `browse-url-secondary-browser-function' and
+`browse-url-handlers'."
   :type browse-url--browser-defcustom-type
   :version "24.1")
 
@@ -595,6 +593,41 @@ down (this *won't* always work)."
   "Wrapper command prepended to the Elinks command-line."
   :type '(repeat (string :tag "Wrapper")))
 
+(defun browse-url--mailto (url &rest args)
+  "Calls `browse-url-mailto-function' with URL and ARGS."
+  (funcall browse-url-mailto-function url args))
+
+(defun browse-url--man (url &rest args)
+  "Calls `browse-url-man-function' with URL and ARGS."
+  (funcall browse-url-man-function url args))
+
+;;;###autoload
+(defvar browse-url-default-handlers
+  '(("\\`mailto:"; . browse-url--mailto)
+    ("\\`man:" . browse-url--man)
+    ("\\`file://" . browse-url-emacs))
+  "Like `browse-url-handlers' but populated by Emacs and packages.
+
+Emacs and external packages capable of browsing certain URLs
+should place their entries in this alist rather than
+`browse-url-handlers' which is reserved for the user.")
+
+(defcustom browse-url-handlers nil
+  "An alist with elements of the form (REGEXP HANDLER).
+Each REGEXP is matched against the URL to be opened in turn and
+the first match's HANDLER is invoked with the URL.
+
+A HANDLER must be a function with the same arguments as
+`browse-url'.
+
+If no REGEXP matches, the same procedure is performed with the
+value of `browse-url-default-handlers'.  If there is also no
+match, the URL is opened using the value of
+`browse-url-browser-function'."
+  :type '(alist :key-type (regexp :tag "Regexp")
+                :value-type (function :tag "Handler"))
+  :version "28.1")
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; URL encoding
 
@@ -768,16 +801,18 @@ narrowed."
   "Ask a WWW browser to load URL.
 Prompt for a URL, defaulting to the URL at or before point.
 Invokes a suitable browser function which does the actual job.
-The variable `browse-url-browser-function' says which browser function to
-use.  If the URL is a mailto: URL, consult `browse-url-mailto-function'
-first, if that exists.
-
-The additional ARGS are passed to the browser function.  See the doc
-strings of the actual functions, starting with `browse-url-browser-function',
-for information about the significance of ARGS (most of the functions
-ignore it).
-If ARGS are omitted, the default is to pass `browse-url-new-window-flag'
-as ARGS."
+
+The variables `browse-url-browser-function',
+`browse-url-handlers', and `browse-url-default-handlers'
+determine which browser function to use.
+
+The additional ARGS are passed to the browser function.  See the
+doc strings of the actual functions, starting with
+`browse-url-browser-function', for information about the
+significance of ARGS (most of the functions ignore it).
+
+If ARGS are omitted, the default is to pass
+`browse-url-new-window-flag' as ARGS."
   (interactive (browse-url-interactive-arg "URL: "))
   (unless (called-interactively-p 'interactive)
     (setq args (or args (list browse-url-new-window-flag))))
@@ -786,12 +821,15 @@ as ARGS."
              (not (string-match "\\`[a-z]+:" url)))
     (setq url (expand-file-name url)))
   (let ((process-environment (copy-sequence process-environment))
-       (function (or (and (string-match "\\`mailto:"; url)
-                          browse-url-mailto-function)
-                      (and (string-match "\\`man:" url)
-                           browse-url-man-function)
-                     browse-url-browser-function))
-       ;; Ensure that `default-directory' exists and is readable (b#6077).
+       (function
+         (catch 'custom-url-handler
+           (dolist (regex-handler (append browse-url-handlers
+                                          browse-url-default-handlers))
+             (when (string-match-p (car regex-handler) url)
+               (throw 'custom-url-handler (cdr regex-handler))))
+           ;; No special handler found.
+           browse-url-browser-function))
+       ;; Ensure that `default-directory' exists and is readable (bug#6077).
        (default-directory (or (unhandled-file-name-directory default-directory)
                               (expand-file-name "~/"))))
     ;; When connected to various displays, be careful to use the display of
@@ -801,15 +839,19 @@ as ARGS."
         (setenv "DISPLAY" (frame-parameter nil 'display)))
     (if (and (consp function)
             (not (functionp function)))
-       ;; The `function' can be an alist; look down it for first match
-       ;; and apply the function (which might be a lambda).
-       (catch 'done
-         (dolist (bf function)
-           (when (string-match (car bf) url)
-             (apply (cdr bf) url args)
-             (throw 'done t)))
-         (error "No browse-url-browser-function matching URL %s"
-                url))
+       ;; The `function' can be an alist; look down it for first
+       ;; match and apply the function (which might be a lambda).
+       ;; However, this usage is deprecated as of Emacs 28.1.
+        (progn
+          (warn "Having `browse-url-browser-function' set to an
+alist is deprecated.  Use `browse-url-handlers' instead.")
+          (catch 'done
+           (dolist (bf function)
+             (when (string-match (car bf) url)
+               (apply (cdr bf) url args)
+               (throw 'done t)))
+           (error "No browse-url-browser-function matching URL %s"
+                  url)))
       ;; Unbound symbols go down this leg, since void-function from
       ;; apply is clearer than wrong-type-argument from dolist.
       (apply function url args))))
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index a454402..9cf9ece 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -518,6 +518,10 @@ Currently this means either text/html or 
application/xhtml+xml."
       (plist-put eww-data :dom document)
       (let ((inhibit-read-only t)
            (inhibit-modification-hooks t)
+            ;; Possibly set by the caller, e.g., `eww-render' which
+            ;; preserves the old URL #target before chasing redirects.
+            (shr-target-id (or shr-target-id
+                               (url-target (url-generic-parse-url url))))
            (shr-external-rendering-functions
              (append
               shr-external-rendering-functions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index aae25d1..7f829f1 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -896,14 +896,13 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
       ;; it.  Call it in a subshell, in order to preserve working
       ;; directory.
       (condition-case nil
-         (progn
-           (setq ret
-                 (if (tramp-adb-send-command-and-check
-                      v
-                      (format "(cd %s; %s)"
-                              (tramp-shell-quote-argument localname) command))
-                     ;; Set return status accordingly.
-                     0 1))
+         (unwind-protect
+             (setq ret (tramp-adb-send-command-and-check
+                        v (format
+                           "(cd %s; %s)"
+                           (tramp-shell-quote-argument localname) command)
+                        t))
+           (unless (natnump ret) (setq ret 1))
            ;; We should add the output anyway.
            (when outbuf
              (with-current-buffer outbuf
@@ -1186,11 +1185,14 @@ This happens for Android >= 4.0."
        (while (re-search-forward "\r+$" nil t)
          (replace-match "" nil nil))))))
 
-(defun tramp-adb-send-command-and-check (vec command)
+(defun tramp-adb-send-command-and-check (vec command &optional exit-status)
   "Run COMMAND and check its exit status.
 Sends `echo $?' along with the COMMAND for checking the exit
 status.  If COMMAND is nil, just sends `echo $?'.  Returns nil if
-the exit status is not equal 0, and t otherwise."
+the exit status is not equal 0, and t otherwise.
+
+Optional argument EXIT-STATUS, if non-nil, triggers the return of
+the exit status."
   (tramp-adb-send-command
    vec (if command
           (format "%s; echo tramp_exit_status $?" command)
@@ -1201,7 +1203,9 @@ the exit status is not equal 0, and t otherwise."
        vec 'file-error "Couldn't find exit status of `%s'" command))
     (skip-chars-forward "^ ")
     (prog1
-       (zerop (read (current-buffer)))
+       (if exit-status
+           (read (current-buffer))
+         (zerop (read (current-buffer))))
       (let ((inhibit-read-only t))
        (delete-region (match-beginning 0) (point-max))))))
 
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 592dcf6..c6eb7a8 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3136,13 +3136,12 @@ STDERR can also be a file name."
       ;; directory.
       (condition-case nil
          (unwind-protect
-              (setq ret
-                   (if (tramp-send-command-and-check
-                        v (format "cd %s && %s"
-                                  (tramp-shell-quote-argument localname)
-                                  command)
-                        t t)
-                       0 1))
+              (setq ret (tramp-send-command-and-check
+                        v (format
+                           "cd %s && %s"
+                           (tramp-shell-quote-argument localname) command)
+                        t t t))
+           (unless (natnump ret) (setq ret 1))
            ;; We should add the output anyway.
            (when outbuf
              (with-current-buffer outbuf
@@ -5239,7 +5238,7 @@ function waits for output unless NOOUTPUT is set."
       found)))
 
 (defun tramp-send-command-and-check
-  (vec command &optional subshell dont-suppress-err)
+  (vec command &optional subshell dont-suppress-err exit-status)
   "Run COMMAND and check its exit status.
 Send `echo $?' along with the COMMAND for checking the exit status.
 If COMMAND is nil, just send `echo $?'.  Return t if the exit
@@ -5247,7 +5246,9 @@ status is 0, and nil otherwise.
 
 If the optional argument SUBSHELL is non-nil, the command is
 executed in a subshell, ie surrounded by parentheses.  If
-DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
+DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null.
+Optional argument EXIT-STATUS, if non-nil, triggers the return of
+the exit status."
   (tramp-send-command
    vec
    (concat (if subshell "( " "")
@@ -5261,7 +5262,9 @@ DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to 
/dev/null."
        vec 'file-error "Couldn't find exit status of `%s'" command))
     (skip-chars-forward "^ ")
     (prog1
-       (zerop (read (current-buffer)))
+       (if exit-status
+           (read (current-buffer))
+         (zerop (read (current-buffer))))
       (let ((inhibit-read-only t))
        (delete-region (match-beginning 0) (point-max))))))
 
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 9b29b84..b5ff6a6 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1852,8 +1852,8 @@ This takes effect when first loading the library.")
   "Keymap for commands for use in HTML mode.")
 
 (defvar html-face-tag-alist
-  '((bold . "b")
-    (italic . "i")
+  '((bold . "strong")
+    (italic . "em")
     (underline . "u")
     (mode-line . "rev"))
   "Value of `sgml-face-tag-alist' for HTML mode.")
@@ -2363,7 +2363,7 @@ have <h1>Very Major Headlines</h1> through <h6>Very Minor 
Headlines</h6>
 
 <p>Paragraphs only need an opening tag.  Line breaks and multiple spaces are
 ignored unless the text is <pre>preformatted.</pre>  Text can be marked as
-<b>bold</b>, <i>italic</i> or <u>underlined</u> using the normal M-o or
+<strong>bold</strong>, <em>italic</em> or <u>underlined</u> using the normal 
M-o or
 Edit/Text Properties/Face commands.
 
 Pages can have <a name=\"SOMENAME\">named points</a> and can link other points
diff --git a/src/bignum.h b/src/bignum.h
index ad9021f..4a906c3 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -108,7 +108,8 @@ bignum_integer (mpz_t *tmp, Lisp_Object i)
   if (FIXNUMP (i))
     {
       mpz_set_intmax (*tmp, XFIXNUM (i));
-      return tmp;
+      /* The unnecessary cast pacifies a buggy GCC 4.8.5.  */
+      return (mpz_t const *) tmp;
     }
   return xbignum_val (i);
 }
diff --git a/src/conf_post.h b/src/conf_post.h
index 953b783..1ef4ff3 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -77,6 +77,7 @@ typedef bool bool_bf;
 # define HAS_ATTRIBUTE(a) HAS_ATTR_##a
 # define HAS_ATTR_cleanup GNUC_PREREQ (3, 4, 0)
 # define HAS_ATTR_no_address_safety_analysis false
+# define HAS_ATTR_no_sanitize false
 # define HAS_ATTR_no_sanitize_address GNUC_PREREQ (4, 8, 0)
 # define HAS_ATTR_no_sanitize_undefined GNUC_PREREQ (4, 9, 0)
 #endif
@@ -294,10 +295,10 @@ extern int emacs_setenv_TZ (char const *);
 /* Attribute of functions whose code should not have addresses
    sanitized.  */
 
-#if __has_attribute (no_sanitize_address)
+#if HAS_ATTRIBUTE (no_sanitize_address)
 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
     __attribute__ ((no_sanitize_address)) ADDRESS_SANITIZER_WORKAROUND
-#elif __has_attribute (no_address_safety_analysis)
+#elif HAS_ATTRIBUTE (no_address_safety_analysis)
 # define ATTRIBUTE_NO_SANITIZE_ADDRESS \
     __attribute__ ((no_address_safety_analysis)) ADDRESS_SANITIZER_WORKAROUND
 #else
@@ -306,9 +307,9 @@ extern int emacs_setenv_TZ (char const *);
 
 /* Attribute of functions whose undefined behavior should not be sanitized.  */
 
-#if __has_attribute (no_sanitize_undefined)
+#if HAS_ATTRIBUTE (no_sanitize_undefined)
 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ 
((no_sanitize_undefined))
-#elif __has_attribute (no_sanitize)
+#elif HAS_ATTRIBUTE (no_sanitize)
 # define ATTRIBUTE_NO_SANITIZE_UNDEFINED \
     __attribute__ ((no_sanitize ("undefined")))
 #else
diff --git a/src/data.c b/src/data.c
index 56ea7aa..3088487 100644
--- a/src/data.c
+++ b/src/data.c
@@ -697,8 +697,14 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
 }
 
 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
-       doc: /* Make SYMBOL's value be void.
-Return SYMBOL.  */)
+       doc: /* Empty out the value cell of SYMBOL, making it void as a 
variable.
+Return SYMBOL.
+
+If a variable is void, trying to evaluate the variable signals a
+`void-variable' error, instead of returning a value.  For more
+details, see Info node `(elisp) Void Variables'.
+
+See also `fmakunbound'.  */)
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
@@ -709,8 +715,14 @@ Return SYMBOL.  */)
 }
 
 DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
-       doc: /* Make SYMBOL's function definition be nil.
-Return SYMBOL.  */)
+       doc: /* Make SYMBOL's function definition be void.
+Return SYMBOL.
+
+If a function definition is void, trying to call a function by that
+name will cause a `void-function' error.  For more details, see Info
+node `(elisp) Function Cells'.
+
+See also `makunbound'.  */)
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
diff --git a/src/editfns.c b/src/editfns.c
index c32488e..763d95b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3019,7 +3019,7 @@ printed representation.  The padding, if any, normally 
goes on the
 left, but it goes on the right if the - flag is present.  The padding
 character is normally a space, but it is 0 if the 0 flag is present.
 The 0 flag is ignored if the - flag is present, or the format sequence
-is something other than %d, %e, %f, and %g.
+is something other than %d, %o, %x, %e, %f, and %g.
 
 For %e and %f sequences, the number after the "." in the precision
 specifier says how many decimal places to show; if zero, the decimal
diff --git a/src/emacs-module.c b/src/emacs-module.c
index e43e490..3d1827c 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -248,7 +248,7 @@ module_decode_utf_8 (const char *str, ptrdiff_t len)
    of `internal_condition_case' etc., and to avoid worrying about
    passing information to the handler functions.  */
 
-#if !__has_attribute (cleanup)
+#if !HAS_ATTRIBUTE (cleanup)
  #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC"
 #endif
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 28d20e3..462539a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4208,6 +4208,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should (zerop (process-file "true")))
            (should-not (zerop (process-file "false")))
            (should-not (zerop (process-file "binary-does-not-exist")))
+           (should (= 42 (process-file "sh" nil nil nil "-c" "exit 42")))
            (with-temp-buffer
              (write-region "foo" nil tmp-name)
              (should (file-exists-p tmp-name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]