commit 531c9a43ad91aa979f02651b135f9e7c3446996f (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sun Apr 17 22:41:14 2016 -0700 Minor fixups for external socket launching * configure.ac (HAVE_LIBSYSTEMD): Change earliest version to 222. * doc/emacs/misc.texi (Emacs Server): * etc/NEWS: Spelling and doc fixes. * src/emacs.c (main) [HAVE_LIBSYSTEMD]: Check for sd_is_socket returning positive, not zero. * src/process.c (external_sock_fd): Instead of initializing here ... (init_process_emacs): ... initialize it here, so that it does the right thing after dump/restore. (connect_network_socket): Simplify socket_to_use test. diff --git a/configure.ac b/configure.ac index 54e9ec5..0f6f650 100644 --- a/configure.ac +++ b/configure.ac @@ -2735,7 +2735,10 @@ AC_SUBST(LIBGNUTLS_CFLAGS) HAVE_LIBSYSTEMD=no if test "${with_libsystemd}" = "yes" ; then - EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 226], + dnl This code has been tested with libsystemd 222 and later. + dnl FIXME: Find the earliest version number for which Emacs should work, + dnl and change '222' to that number. + EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 222], [HAVE_LIBSYSTEMD=yes], [HAVE_LIBSYSTEMD=no]) if test "${HAVE_LIBSYSTEMD}" = "yes"; then AC_DEFINE(HAVE_LIBSYSTEMD, 1, [Define if using libsystemd.]) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 775cda9..20f2d66 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1586,7 +1586,7 @@ waits in the background, listening for edit requests. An external process can invoke the Emacs server when a connection event occurs upon a specified socket and pass the socket to the new Emacs server process. An instance of this is @command{systemd}'s -socket functionaly: the @command{systemd} service creates a socket and +socket functionality: the @command{systemd} service creates a socket and listens for connections on it; when @command{emacsclient} connects to it for the first time, @command{systemd} can launch the Emacs server and hand over the socket to it for servicing @command{emacsclient} diff --git a/etc/NEWS b/etc/NEWS index ecb52c1..2373347 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -32,12 +32,12 @@ the default in developer builds. As before, use '--enable-gcc-warnings' to stop the build if GCC issues warnings. +++ -** Emacs server now has socket-launching support. This allows socket -based activation, where an external process can invoke the Emacs -server process upon a socket connection event and hand over the socket -to Emacs. Emacs will use this socket for servicing emacsclient -commands. systemd can make use of this new functionally but can be -disabled with the configure option '--disable-libsystemd'. +** The Emacs server now has socket-launching support. This allows +socket based activation, where an external process like systemd can +invoke the Emacs server process upon a socket connection event and +hand the socket over to Emacs. Emacs uses this socket to service +emacsclient commands. This new functionality can be disabled with the +configure option '--disable-libsystemd'. ** New configure option '--disable-build-details' attempts to build an Emacs that is more likely to be reproducible; that is, if you build diff --git a/src/emacs.c b/src/emacs.c index a51df09..a738bac 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -57,9 +57,9 @@ along with GNU Emacs. If not, see . */ #endif #ifdef HAVE_LIBSYSTEMD -#include -#include -#endif /* HAVE_LIBSYSTEMD */ +# include +# include +#endif #ifdef HAVE_WINDOW_SYSTEM #include TERM_HEADER @@ -681,9 +681,6 @@ main (int argc, char **argv) char dname_arg2[80]; #endif char *ch_to_dir = 0; -#ifdef HAVE_LIBSYSTEMD - int systemd_socket; -#endif /* If we use --chdir, this records the original directory. */ char *original_pwd = 0; @@ -1008,16 +1005,17 @@ main (int argc, char **argv) } #ifdef HAVE_LIBSYSTEMD - /* Read the number of sockets passed through by systemd. */ - systemd_socket = sd_listen_fds(1); + /* Read the number of sockets passed through by systemd. */ + int systemd_socket = sd_listen_fds (1); if (systemd_socket > 1) - fprintf (stderr, "\nWarning: systemd has passed more than one socket to the Emacs process.\n\ -Try adding 'Accept=false' in the Emacs socket unit file.\n"); - - else if (systemd_socket == 1 && - sd_is_socket (SD_LISTEN_FDS_START, - AF_UNSPEC, SOCK_STREAM, 1) >= 0) + fprintf (stderr, + ("\n" + "Warning: systemd passed more than one socket to Emacs.\n" + "Try 'Accept=false' in the Emacs socket unit file.\n")); + else if (systemd_socket == 1 + && (0 < sd_is_socket (SD_LISTEN_FDS_START, + AF_UNSPEC, SOCK_STREAM, 1))) set_external_socket_descriptor (SD_LISTEN_FDS_START); #endif /* HAVE_LIBSYSTEMD */ diff --git a/src/process.c b/src/process.c index 2dfad66..a222a5b 100644 --- a/src/process.c +++ b/src/process.c @@ -267,8 +267,8 @@ static int max_process_desc; /* The largest descriptor currently in use for input; -1 if none. */ static int max_input_desc; -/* The descriptor of any sockets passed to Emacs; -1 if none. */ -static int external_sock_fd = -1; +/* The descriptor of any socket passed to Emacs; -1 if none. */ +static int external_sock_fd; /* Indexed by descriptor, gives the process (if any) for that descriptor. */ static Lisp_Object chan_process[FD_SETSIZE]; @@ -3099,11 +3099,10 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, { socket_to_use = external_sock_fd; - /* Ensure we don't consume the external socket twice. */ + /* Ensure we don't consume the external socket twice. */ external_sock_fd = -1; } - /* Do this in case we never enter the while-loop below. */ count1 = SPECPDL_INDEX (); s = -1; @@ -3123,15 +3122,15 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, sa = xmalloc (addrlen); conv_lisp_to_sockaddr (family, ip_address, sa, addrlen); - if (socket_to_use != -1) - s = socket_to_use; - else - s = socket (family, p->socktype | SOCK_CLOEXEC, p->ai_protocol); - + s = socket_to_use; if (s < 0) { - xerrno = errno; - continue; + s = socket (family, p->socktype | SOCK_CLOEXEC, p->ai_protocol); + if (s < 0) + { + xerrno = errno; + continue; + } } #ifdef DATAGRAM_SOCKETS @@ -3186,11 +3185,9 @@ connect_network_socket (Lisp_Object proc, Lisp_Object ip_addresses, report_file_error ("Cannot set reuse option on server socket", Qnil); } - /* If we are passed a socket descriptor, it should be - already bound. */ - if (socket_to_use == -1) - if (bind (s, sa, addrlen)) - report_file_error ("Cannot bind server socket", Qnil); + /* If passed a socket descriptor, it should be already bound. */ + if (socket_to_use < 0 && bind (s, sa, addrlen) != 0) + report_file_error ("Cannot bind server socket", Qnil); #ifdef HAVE_GETSOCKNAME if (p->port == 0) @@ -7741,9 +7738,9 @@ catch_child_signal (void) `:use-external-socket' option. The fd should have been checked to ensure it is a valid socket and is already bound. */ void -set_external_socket_descriptor(int fd) +set_external_socket_descriptor (int fd) { - external_sock_fd = fd; + external_sock_fd = fd; } @@ -7775,7 +7772,7 @@ init_process_emacs (void) FD_ZERO (&non_keyboard_wait_mask); FD_ZERO (&non_process_wait_mask); FD_ZERO (&write_mask); - max_process_desc = max_input_desc = -1; + max_process_desc = max_input_desc = external_sock_fd = -1; memset (fd_callback_info, 0, sizeof (fd_callback_info)); FD_ZERO (&connect_wait_mask); commit 5f265490b646e43bdaa0c5ce5102172f7b117d84 Author: Simen Heggestøyl Date: Fri Apr 15 17:36:10 2016 +0200 Add HTML5 tags to HTML mode * lisp/textmodes/sgml-mode.el (html-tag-alist): Add HTML5 tags. (html-tag-help): Add short descriptions of those tags. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 0937c00..990c09b 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -1818,6 +1818,8 @@ This takes effect when first loading the library.") ("col" t ,@cellhalign ,@cellvalign ("span") ("width")) ("colgroup" \n ,@cellhalign ,@cellvalign ("span") ("width")) ("dir" ,@list) + ("figcaption") + ("figure" \n) ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7) ("form" (\n _ \n "" ">")) @@ -1872,7 +1874,13 @@ This takes effect when first loading the library.") ("article" \n) ("aside" \n) ("au") + ("audio" \n + ("src") ("crossorigin" ("anonymous") ("use-credentials")) + ("preload" ("none") ("metadata") ("auto")) + ("autoplay" "autoplay") ("mediagroup") ("loop" "loop") + ("muted" "muted") ("controls" "controls")) ("b") + ("bdi") ("bdo" nil ("lang") ("dir" ("ltr") ("rtl"))) ("big") ("blink") @@ -1885,10 +1893,12 @@ This takes effect when first loading the library.") ("type" ("submit") ("reset") ("button")) ("disabled" "disabled") ("tabindex") ("accesskey") ("onfocus") ("onblur")) + ("canvas" \n ("width") ("height")) ("caption" ("valign" ("top") ("bottom"))) ("center" \n) ("cite") ("code" \n) + ("datalist" \n) ("dd" ,(not sgml-xml-mode)) ("del" nil ("cite") ("datetime")) ("dfn") @@ -1900,6 +1910,7 @@ This takes effect when first loading the library.") ("dt" (t _ (if sgml-xml-mode "") "
" (if sgml-xml-mode "
") \n)) ("em") + ("embed" t ("src") ("type") ("width") ("height")) ("fieldset" \n) ("fn" "id" "fn") ;; Footnotes were deprecated in HTML 3.2 ("footer" \n) @@ -1928,9 +1939,13 @@ This takes effect when first loading the library.") ("lang") ("legend" nil ("accesskey")) ("li" ,(not sgml-xml-mode)) + ("main" \n) ("map" \n ("name")) + ("mark") ("math" \n) ("meta" t ("http-equiv") ("name") ("content") ("scheme")) + ("meter" nil ("value") ("min") ("max") ("low") ("high") + ("optimum")) ("nav" \n) ("nobr") ("noframes" \n) @@ -1942,18 +1957,24 @@ This takes effect when first loading the library.") ("disabled" "disabled") ("tabindex") ("onfocus") ("onblur") ("onchange")) ("option" t ("value") ("label") ("selected" t)) + ("output" nil ("for") ("form") ("name")) ("over" t) ("param" t ("name") ("value") ("valuetype" ("data") ("ref") ("object")) ("type")) ("person") ;; Tag for person's name tag deprecated in HTML 3.2 ("pre" \n) + ("progress" nil ("value") ("max")) ("q" nil ("cite")) ("rev") + ("rp" t) + ("rt" t) + ("ruby") ("s") ("samp") ("script" nil ("charset") ("type") ("src") ("defer" "defer")) ("section" \n) ("small") + ("source" t ("src") ("type") ("media")) ("span" nil ("class" ("builtin") @@ -1968,12 +1989,23 @@ This takes effect when first loading the library.") ("strong") ("style" \n ("type") ("media") ("title")) ("sub") + ("summary") ("sup") + ("time" nil ("datetime")) ("title") ("tr" t) + ("track" t + ("kind" ("subtitles") ("captions") ("descriptions") + ("chapters") ("metadata")) + ("src") ("srclang") ("label") ("default")) ("tt") ("u") ("var") + ("video" \n + ("src") ("crossorigin" ("anonymous") ("use-credentials")) + ("poster") ("preload" ("none") ("metadata") ("auto")) + ("autoplay" "autoplay") ("mediagroup") ("loop" "loop") + ("muted" "muted") ("controls" "controls") ("width") ("height")) ("wbr" t))) "Value of `sgml-tag-alist' for HTML mode.") @@ -1988,8 +2020,10 @@ This takes effect when first loading the library.") ("article" . "An independent part of document or site") ("aside" . "Secondary content related to surrounding content (e.g. page or article)") ("au" . "Author") + ("audio" . "Sound or audio stream") ("b" . "Bold face") ("base" . "Base address for URLs") + ("bdi" . "Text isolated for bidirectional formatting") ("bdo" . "Override text directionality") ("big" . "Font size") ("blink" . "Blinking text") @@ -1998,6 +2032,7 @@ This takes effect when first loading the library.") ("box" . "Math fraction") ("br" . "Line break") ("button" . "Clickable button") + ("canvas" . "Script generated graphics canvas") ("caption" . "Table caption") ("center" . "Centered text") ("changed" . "Change bars") @@ -2005,6 +2040,7 @@ This takes effect when first loading the library.") ("code" . "Formatted source code") ("col" . "Group of attribute specifications for table columns") ("colgroup" . "Group of columns") + ("datalist" . "A set of predefined options") ("dd" . "Definition of term") ("del" . "Deleted text") ("dfn" . "Defining instance of a term") @@ -2017,8 +2053,10 @@ This takes effect when first loading the library.") ("fieldset" . "Group of related controls and labels") ("fig" . "Figure") ("figa" . "Figure anchor") + ("figcaption" . "Caption for a figure") ("figd" . "Figure description") ("figt" . "Figure text") + ("figure" . "Self-contained content, often with a caption") ("fn" . "Footnote") ;; No one supports special footnote rendering. ("font" . "Font size") ("footer" . "Footer of a section") @@ -2049,10 +2087,13 @@ This takes effect when first loading the library.") ("legend" . "Caption for a fieldset") ("li" . "List item") ("link" . "Link relationship") + ("main" . "Main content of the document body") ("map" . "Image map (a clickable link area") + ("mark" . "Highlighted text") ("math" . "Math formula") ("menu" . "List of commands") ("meta" . "Document properties") + ("meter" . "Scalar measurement within a known range") ("mh" . "Form mail header") ("nav" . "Group of navigational links") ("nextid" . "Allocate new id") @@ -2063,25 +2104,32 @@ This takes effect when first loading the library.") ("ol" . "Ordered list") ("optgroup" . "Group of options") ("option" . "Selection list item") + ("output" . "Result of a calculation or user action") ("over" . "Math fraction rule") ("p" . "Paragraph start") ("panel" . "Floating panel") ("param" . "Parameters for an object") ("person" . "Person's name") ("pre" . "Preformatted fixed width text") + ("progress" . "Completion progress of a task") ("q" . "Quotation") ("rev" . "Reverse video") + ("rp" . "Fallback text for when ruby annotations aren't supported") + ("rt" . "Ruby text component of a ruby annotation") + ("ruby" . "Ruby annotation") ("s" . "Strikeout") ("samp" . "Sample text") ("script" . "Executable script within a document") ("section" . "Section of a document") ("select" . "Selection list") ("small" . "Font size") + ("source" . "Media resource for media elements") ("sp" . "Nobreak space") ("span" . "Generic inline container") ("strong" . "Standout text") ("style" . "Style information") ("sub" . "Subscript") + ("summary" . "Summary, caption, or legend") ("sup" . "Superscript") ("table" . "Table with rows and columns") ("tb" . "Table vertical break") @@ -2091,12 +2139,15 @@ This takes effect when first loading the library.") ("tfoot" . "Table foot") ("th" . "Table header cell") ("thead" . "Table head") + ("time" . "Content with optional machine-readable timestamp") ("title" . "Document title") ("tr" . "Table row separator") + ("track" . "Timed text track for media elements") ("tt" . "Typewriter face") ("u" . "Underlined text") ("ul" . "Unordered list") ("var" . "Math variable face") + ("video" . "Video or movie") ("wbr" . "Enable
within ")) "Value of variable `sgml-tag-help' for HTML mode.") commit 84c4cc589ddd5fcd5bf5ca5256727255c4819043 Author: Lars Magne Ingebrigtsen Date: Sun Apr 17 19:30:44 2016 +0200 Finish idna->puny changes in last Message patch * lisp/gnus/message.el (message-idna-to-ascii-rhs-1): Use puny instead of idna functions. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index fc339a4..1ca7c5c 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -48,6 +48,7 @@ (require 'dired) (require 'mm-util) (require 'rfc2047) +(require 'puny) (autoload 'mailclient-send-it "mailclient") @@ -1910,7 +1911,6 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (autoload 'gnus-output-to-rmail "gnus-util") (autoload 'gnus-request-post "gnus-int") (autoload 'gnus-server-string "gnus") -(autoload 'idna-to-ascii "idna") (autoload 'message-setup-toolbar "messagexmas") (autoload 'mh-new-draft-name "mh-comp") (autoload 'mh-send-letter "mh-comp") @@ -5851,7 +5851,7 @@ subscribed address (and not the additional To and Cc header contents)." ;; the domain part, i.e., if it is a local user's address. (setq ace (if (string-match "\\`[[:ascii:]]*\\'" rhs) rhs - (downcase (idna-to-ascii rhs)))) + (downcase (puny-encode-domain rhs)))) (when (and (not (equal rhs ace)) (or (not (eq message-use-idna 'ask)) (y-or-n-p (format "Replace %s with %s in %s:? " commit 50b93f40d0d41ded6b9c0ee83574e828c869f62c Author: Lars Magne Ingebrigtsen Date: Sun Apr 17 19:29:58 2016 +0200 Use puny.el instead of idna.el functions in Gnus * lisp/gnus/gnus-art.el (gnus-use-idna): Default to t (since Emacs comes with IDNA support built in). (article-decode-idna-rhs): Use `puny-decode-domain' instead of `idna-to-unicode'. * lisp/gnus/gnus-sum.el (gnus-summary-idna-message): Ditto. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 94ebbdd..dea8d1f 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -1610,18 +1610,9 @@ It is a string, such as \"PGP\". If nil, ask user." :type 'string :group 'mime-security) -(defvar idna-program) - -(defcustom gnus-use-idna (and (mm-coding-system-p 'utf-8) - (condition-case nil - (require 'idna) - (file-error) - (invalid-operation)) - idna-program - (executable-find idna-program)) - "Whether IDNA decoding of headers is used when viewing messages. -This requires GNU Libidn, and by default only enabled if it is found." - :version "22.1" +(defcustom gnus-use-idna t + "Whether IDNA decoding of headers is used when viewing messages." + :version "25.2" :group 'gnus-article-headers :type 'boolean) @@ -2591,8 +2582,6 @@ If PROMPT (the prefix), prompt for a coding system to use." t t nil 1)) (goto-char (point-min))))))) -(autoload 'idna-to-unicode "idna") - (defun article-decode-idna-rhs () "Decode IDNA strings in RHS in various headers in current buffer. The following headers are decoded: From:, To:, Cc:, Reply-To:, @@ -2610,7 +2599,7 @@ Mail-Reply-To: and Mail-Followup-To:." (save-excursion (and (re-search-backward "^[^ \t]" nil t) (looking-at "From\\|To\\|Cc\\|Reply-To\\|Mail-Reply-To\\|Mail-Followup-To"))) - (setq unicode (idna-to-unicode ace)))) + (setq unicode (puny-decode-domain ace)))) (unless (string= ace unicode) (replace-match unicode nil nil nil 1))))))))) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 6b3add2..67b4268 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -9807,8 +9807,6 @@ prefix specifies how many places to rotate each letter forward." ;; Create buttons and stuff... (gnus-treat-article nil)) -(declare-function idna-to-unicode "ext:idna" (str)) - (defun gnus-summary-idna-message (&optional arg) "Decode IDNA encoded domain names in the current articles. IDNA encoded domain names looks like `xn--bar'. If a string @@ -9818,25 +9816,16 @@ invalid IDNA string (`xn--bar' is invalid). You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/') installed for this command to work." (interactive "P") - (if (not (and (mm-coding-system-p 'utf-8) - (condition-case nil - (require 'idna) - (file-error) - (invalid-operation)) - (symbol-value 'idna-program) - (executable-find (symbol-value 'idna-program)))) - (gnus-message - 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)") - (gnus-summary-select-article) - (let ((mail-header-separator "")) - (gnus-eval-in-buffer-window gnus-article-buffer - (save-restriction - (widen) - (let ((start (window-start)) - buffer-read-only) - (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t) - (replace-match (idna-to-unicode (match-string 1)))) - (set-window-start (get-buffer-window (current-buffer)) start))))))) + (gnus-summary-select-article) + (let ((mail-header-separator "")) + (gnus-eval-in-buffer-window gnus-article-buffer + (save-restriction + (widen) + (let ((start (window-start)) + buffer-read-only) + (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t) + (replace-match (puny-decode-domain (match-string 1)))) + (set-window-start (get-buffer-window (current-buffer)) start)))))) (defun gnus-summary-morse-message (&optional arg) "Morse decode the current article." commit c5dfaae30f1f7a9256e49d26ec5e69be608c8182 Author: Lars Magne Ingebrigtsen Date: Sun Apr 17 19:17:12 2016 +0200 Mention `message-use-idna' in NEWS diff --git a/etc/NEWS b/etc/NEWS index f4a4526..ecb52c1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -144,6 +144,12 @@ for the ChangeLog file, if none already exists. Customize ** Tramp +** Message + +--- +*** `message-use-idna' now defaults to t (because Emacs comes with +built-in IDNA support now). + +++ *** New connection method "sg", which allows to edit files under different group ID. commit 64699a5ac88a63d5d96c0e3468207a82c84b68c2 Author: Lars Magne Ingebrigtsen Date: Sun Apr 17 19:14:01 2016 +0200 Default `message-use-idna' to t * lisp/gnus/message.el (message-use-idna): Default to t (since Emacs comes with puny.el now). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 3b2cf67..fc339a4 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -1756,25 +1756,9 @@ no, only reply back to the author." :type '(radio (const :format "%v " nil) (string :format "FQDN: %v"))) -(defcustom message-use-idna - (and (or (mm-coding-system-p 'utf-8) - (condition-case nil - (let (mucs-ignore-version-incompatibilities) - (require 'un-define)) - (error))) - (condition-case nil - (require 'idna) - (file-error) - (invalid-operation)) - idna-program - (executable-find idna-program) - (string= (idna-to-ascii "räksmörgås") "xn--rksmrgs-5wao1o") - t) - "Whether to encode non-ASCII in domain names into ASCII according to IDNA. -GNU Libidn, and in particular the elisp package \"idna.el\" and -the external program \"idn\", must be installed for this -functionality to work." - :version "22.1" +(defcustom message-use-idna t + "Whether to encode non-ASCII in domain names into ASCII according to IDNA." + :version "25.2" :group 'message-headers :link '(custom-manual "(message)IDNA") :type '(choice (const :tag "Ask" ask)