commit ec98420dbc5babb783b784ca3eb31667fb376739 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Dec 29 20:42:26 2014 -0800 * PROBLEMS: Omit obsolete mention of FQDNs. diff --git a/etc/ChangeLog b/etc/ChangeLog index ee0958f..3c48c51 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-12-30 Paul Eggert + + * PROBLEMS: Omit obsolete mention of FQDNs. + 2014-12-27 Álvar Ibeas (tiny change) * tutorials/TUTORIAL.es: Improve style consistency. Spelling fixes. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 67a26b9..e1463f1 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -364,8 +364,8 @@ For example, (system-name) returns some variation on "localhost.localdomain", rather the name you were expecting. You need to configure your machine with a fully qualified domain name, -(i.e. a name with at least one ".") either in /etc/hosts, -/etc/hostname, the NIS, or wherever your system calls for specifying this. +(i.e., a name with at least one "."), either in /etc/hostname +or wherever your system calls for specifying this. If you cannot fix the configuration, you can set the Lisp variable mail-host-address to the value you want. @@ -457,17 +457,6 @@ problem by adding this to your .cshrc file: endif endif -*** Emacs startup on GNU/Linux systems (and possibly other systems) is slow. - -This can happen if the system is misconfigured and Emacs can't get the -full qualified domain name, FQDN. You should have your FQDN in the -/etc/hosts file, something like this: - -127.0.0.1 localhost -129.187.137.82 nuc04.t30.physik.tu-muenchen.de nuc04 - -The way to set this up may vary on non-GNU systems. - *** Attempting to visit remote files via ange-ftp fails. If the error message is "ange-ftp-file-modtime: Specified time is not commit 21f9a9513a7a91ed630412b4c48ad29a5cabc71f Author: Dmitry Gutov Date: Tue Dec 30 05:18:48 2014 +0200 Hide "Set Tags File Name" and the separator when tags are not used * lisp/menu-bar.el (menu-bar-goto-uses-etags-p): New function. (menu-bar-goto-menu): Use it to show or hide the `set-tags-name' and `separator-tag-file' items. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5ad67ab..6249a30 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-30 Dmitry Gutov + + * menu-bar.el (menu-bar-goto-uses-etags-p): New function. + (menu-bar-goto-menu): Use it to show or hide the `set-tags-name' + and `separator-tag-file' items. + 2014-12-29 Paul Eggert * obsolete/pc-select.el (pc-selection-mode): Use system-type. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index c5f587e..ea5794d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -373,13 +373,14 @@ (bindings--define-key menu [set-tags-name] '(menu-item "Set Tags File Name..." visit-tags-table - :help "Tell Tags commands which tag table file to use")) + :visible (menu-bar-goto-uses-etags-p) + :help "Tell navigation commands which tag table file to use")) (bindings--define-key menu [separator-tag-file] - menu-bar-separator) + '(menu-item "--" nil :visible (menu-bar-goto-uses-etags-p))) (bindings--define-key menu [xref-pop] - '(menu-item "Back..." xref-pop-marker-stack + '(menu-item "Back" xref-pop-marker-stack :help "Back to the position of the last search")) (bindings--define-key menu [xref-apropos] @@ -409,6 +410,9 @@ :help "Read a line number and go to that line")) menu)) +(defun menu-bar-goto-uses-etags-p () + (or (not (boundp 'xref-find-function)) + (eq xref-find-function 'etags-xref-find))) (defvar yank-menu (cons (purecopy "Select Yank") nil)) (fset 'yank-menu (cons 'keymap yank-menu)) commit 8ae52a77036340ca03f819f4bdb7738d48ce2d8c Author: Eli Zaretskii Date: Mon Dec 29 23:02:22 2014 +0200 Fix the MS-Windows build. src/sysdep.c [WINDOWSNT]: Include sys/socket.h, without which this file doesn't compile on MS-Windows. diff --git a/src/ChangeLog b/src/ChangeLog index 2ab5101..51e8d11 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-12-29 Eli Zaretskii + + * sysdep.c [WINDOWSNT]: Include sys/socket.h, without which this + file doesn't compile on MS-Windows. + 2014-12-28 Paul Eggert Fix produce_composite_width typo diff --git a/src/sysdep.c b/src/sysdep.c index 013c86b..7158f38 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -110,6 +110,9 @@ along with GNU Emacs. If not, see . */ #define _P_WAIT 0 int _cdecl _spawnlp (int, const char *, const char *, ...); int _cdecl _getpid (void); +/* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and + several prototypes of functions called below. */ +#include #endif #include "syssignal.h" commit a5e5d7773b39cd39924404d40093ba44fc0de7f8 Author: Paul Eggert Date: Mon Dec 29 12:45:25 2014 -0800 * obsolete/pc-select.el (pc-selection-mode): Use system-type. This is instead of system-name, which is both wrong here and obsolete. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7bfc38c..5ad67ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-29 Paul Eggert + + * obsolete/pc-select.el (pc-selection-mode): Use system-type. + This is instead of system-name, which is both wrong here and obsolete. + 2014-12-29 Dmitry Gutov * menu-bar.el (menu-bar-next-tag-other-window) diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el index 5ee0818..5404f49 100644 --- a/lisp/obsolete/pc-select.el +++ b/lisp/obsolete/pc-select.el @@ -337,7 +337,7 @@ but before calling PC Selection mode): (cadr pc-select-meta-moves-sexps-key-bindings)) (if (or pc-select-selection-keys-only (eq window-system 'x) - (memq system-name '(ms-dos windows-nt))) + (memq system-type '(ms-dos windows-nt))) nil pc-select-tty-key-bindings))) @@ -346,7 +346,7 @@ but before calling PC Selection mode): (unless (or pc-select-selection-keys-only (eq window-system 'x) - (memq system-name '(ms-dos windows-nt))) + (memq system-type '(ms-dos windows-nt))) ;; it is not clear that we need the following line ;; I hope it doesn't do too much harm to leave it in, though... (setq pc-select-old-M-delete-binding @@ -355,7 +355,7 @@ but before calling PC Selection mode): (when (and (not pc-select-selection-keys-only) (or (eq window-system 'x) - (memq system-name '(ms-dos windows-nt))) + (memq system-type '(ms-dos windows-nt))) (fboundp 'normal-erase-is-backspace-mode)) (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1 normal-erase-is-backspace)) @@ -378,13 +378,13 @@ but before calling PC Selection mode): (current-global-map)) (unless (or pc-select-selection-keys-only (eq window-system 'x) - (memq system-name '(ms-dos windows-nt))) + (memq system-type '(ms-dos windows-nt))) ;; it is not clear that we need the following line ;; I hope it doesn't do too much harm to leave it in, though... (define-key function-key-map [M-delete] [?\M-d])) (when (and (not pc-select-selection-keys-only) (or (eq window-system 'x) - (memq system-name '(ms-dos windows-nt))) + (memq system-type '(ms-dos windows-nt))) (fboundp 'normal-erase-is-backspace-mode)) (normal-erase-is-backspace-mode 1)) (setq highlight-nonselected-windows nil) @@ -395,7 +395,7 @@ but before calling PC Selection mode): (when pc-select-key-bindings-alist (when (and (not pc-select-selection-keys-only) (or (eq window-system 'x) - (memq system-name '(ms-dos windows-nt)))) + (memq system-type '(ms-dos windows-nt)))) (pc-select-restore-mode normal-erase-is-backspace-mode)) (pc-select-restore-keys commit 973110680c094b7a3bbcebbfbafb9abfc7adc8fd Author: Paul Eggert Date: Mon Dec 29 12:39:58 2014 -0800 Fix previous patch to match its commit message diff --git a/ChangeLog b/ChangeLog index 1fc7d66..6557ef9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2014-12-29 Paul Eggert system-name's returned value can vary + Also, the system-name variable is now obsolete. Fixes Bug#19438. * doc/lispref/os.texi (System Environment): * etc/NEWS: Document this. @@ -8,6 +9,7 @@ (Displaying the current file name in the titlebar): * lisp/desktop.el (desktop-save-frameset): * lisp/dnd.el (dnd-get-local-file-uri): + * lisp/gnus/message.el (message-make-fqdn): * lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers) (nnvirtual-update-xref-header): * lisp/nxml/rng-uri.el (rng-uri-file-name-1): @@ -16,14 +18,18 @@ * src/xrdb.c (get_environ_db): * src/xterm.c (same_x_server): * src/xterm.c (x_term_init): - Prefer (system-name) to system-name. + Prefer (system-name) to system-name, and avoid naming + locals 'system-name'. * doc/misc/smtpmail.texi (Server workarounds): Fix grammar. + * lisp/startup.el (system-name): Now an obsolete variable. * src/editfns.c (cached_system_name): New static var. (init_and_cache_system_name): New function. (init_editfns, Fsystem_name): Use it. (syms_of_editfns): Initialize it and Vsystem_name to the same value. - * src/sysdep.c (init_system_name): Don't create a new string if - the current value is already correct. + * src/sysdep.c [HAVE_SOCKETS]: Don't include , . + (h_errno) [TRY_AGAIN && !HAVE_H_ERRNO]: Remove decl. + (init_system_name) [HAVE_SOCKETS]: Don't canonicalize the name. + Don't create a new string if the current value is already correct. 2014-12-28 Paul Eggert diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 1300bc7..91bd190 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -917,18 +917,6 @@ This function returns the name of the machine you are running on, as a string. @end defun - The symbol @code{system-name} is a variable as well as a function. In -fact, the function normally returns whatever value the variable -@code{system-name} currently holds. Thus, you can set the variable -@code{system-name} in case Emacs is confused about the name of your -system. If you do not set the variable, the function updates -the variable to the current system name; this behavior can be useful -if your Emacs process has changed systems or if the system has changed -names. - -The @code{system-name} variable is also useful for constructing frame titles -(@pxref{Frame Titles}). - @c FIXME seems like this section is not the best place for this option? @defopt mail-host-address If this variable is non-@code{nil}, it is used instead of diff --git a/etc/NEWS b/etc/NEWS index e5c988b..ae0cb70 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -542,7 +542,9 @@ optional repeat-count argument. ** Function `sort' can deal with vectors. ** Function `system-name' now returns an updated value if the current -system's name has changed, or if the Emacs process has changed systems. +system's name has changed or if the Emacs process has changed systems, +and to avoid long waits it no longer consults DNS to canonicalize the +name. The variable `system-name' is now obsolete. --- ** New utilities in subr-x.el: diff --git a/lisp/dnd.el b/lisp/dnd.el index 2b68b02..3fda471 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -122,17 +122,17 @@ Return nil if URI is not a local file." ;; The hostname may be our hostname, in that case, convert to a local ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? - (let ((system-name (system-name))) + (let ((sysname (system-name))) (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) (downcase (match-string 1 uri)))) - (system-name-no-dot - (downcase (if (string-match "^[^\\.]+" system-name) - (match-string 0 system-name) - system-name)))) + (sysname-no-dot + (downcase (if (string-match "^[^\\.]+" sysname) + (match-string 0 sysname) + sysname)))) (when (and hostname (or (string-equal "localhost" hostname) - (string-equal (downcase system-name) hostname) - (string-equal system-name-no-dot hostname))) + (string-equal (downcase sysname) hostname) + (string-equal sysname-no-dot hostname))) (concat "file://" (substring uri (+ 7 (length hostname)))))))) (defsubst dnd-unescape-uri (uri) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index d58a292..ee5d824 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5849,7 +5849,7 @@ give as trustworthy answer as possible." (defun message-make-fqdn () "Return user's fully qualified domain name." - (let* ((system-name (system-name)) + (let* ((sysname (system-name)) (user-mail (message-user-mail-address)) (user-domain (if (and user-mail @@ -5863,10 +5863,10 @@ give as trustworthy answer as possible." (not (string-match message-bogus-system-names message-user-fqdn))) ;; `message-user-fqdn' seems to be valid message-user-fqdn) - ((and (string-match message-valid-fqdn-regexp system-name) - (not (string-match message-bogus-system-names system-name))) + ((and (string-match message-valid-fqdn-regexp sysname) + (not (string-match message-bogus-system-names sysname))) ;; `system-name' returned the right result. - system-name) + sysname) ;; Try `mail-host-address'. ((and (boundp 'mail-host-address) (stringp mail-host-address) @@ -5881,7 +5881,7 @@ give as trustworthy answer as possible." user-domain) ;; Default to this bogus thing. (t - (concat system-name + (concat sysname ".i-did-not-set--mail-host-address--so-tickle-me"))))) (defun message-make-domain () diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index d13b492..61bf556 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -99,7 +99,7 @@ component group will show up when you enter the virtual group.") (let ((vbuf (nnheader-set-temp-buffer (get-buffer-create " *virtual headers*"))) (carticles (nnvirtual-partition-sequence articles)) - (system-name (system-name)) + (sysname (system-name)) cgroup carticle article result prefix) (while carticles (setq cgroup (caar carticles)) @@ -151,7 +151,7 @@ component group will show up when you enter the virtual group.") ;; and clean up the xrefs. (princ article nntp-server-buffer) (nnvirtual-update-xref-header cgroup carticle - prefix (system-name)) + prefix sysname) (forward-line 1)) ) @@ -378,7 +378,7 @@ component group will show up when you enter the virtual group.") (mapc 'nnheader-insert-nov headers)))) -(defun nnvirtual-update-xref-header (group article prefix system-name) +(defun nnvirtual-update-xref-header (group article prefix sysname) "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." ;; Move to beginning of Xref field, creating a slot if needed. (beginning-of-line) @@ -393,7 +393,7 @@ component group will show up when you enter the virtual group.") (forward-char -1) (delete-char 1)) - (insert "Xref: " (system-name) " " group ":") + (insert "Xref: " sysname " " group ":") (princ article (current-buffer)) (insert " ") diff --git a/lisp/startup.el b/lisp/startup.el index 8e981bb..0c5e66a 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -358,6 +358,8 @@ this variable usefully is to set it while building and dumping Emacs." :set (lambda (_variable _value) (error "Customizing `site-run-file' does not work"))) +(make-obsolete-variable 'system-name "use (system-name) instead" "25.1") + (defcustom mail-host-address nil "Name of this machine, for purposes of naming users. If non-nil, Emacs uses this instead of `system-name' when constructing diff --git a/src/sysdep.c b/src/sysdep.c index b4a9be1..013c86b 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1406,17 +1406,6 @@ setup_pty (int fd) } #endif /* HAVE_PTYS */ -#ifdef HAVE_SOCKETS -#include -#include -#endif /* HAVE_SOCKETS */ - -#ifdef TRY_AGAIN -#ifndef HAVE_H_ERRNO -extern int h_errno; -#endif -#endif /* TRY_AGAIN */ - void init_system_name (void) { @@ -1447,101 +1436,6 @@ init_system_name (void) hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1, min (PTRDIFF_MAX, SIZE_MAX), 1); } -#ifdef HAVE_SOCKETS - /* Turn the hostname into the official, fully-qualified hostname. - Don't do this if we're going to dump; this can confuse system - libraries on some machines and make the dumped emacs core dump. */ -#ifndef CANNOT_DUMP - if (initialized) -#endif /* not CANNOT_DUMP */ - if (! strchr (hostname, '.')) - { - int count; -#ifdef HAVE_GETADDRINFO - struct addrinfo *res; - struct addrinfo hints; - int ret; - - memset (&hints, 0, sizeof (hints)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_CANONNAME; - - for (count = 0;; count++) - { - if ((ret = getaddrinfo (hostname, NULL, &hints, &res)) == 0 - || ret != EAI_AGAIN) - break; - - if (count >= 5) - break; - Fsleep_for (make_number (1), Qnil); - } - - if (ret == 0) - { - struct addrinfo *it = res; - while (it) - { - char *fqdn = it->ai_canonname; - if (fqdn && strchr (fqdn, '.') - && strcmp (fqdn, "localhost.localdomain") != 0) - break; - it = it->ai_next; - } - if (it) - { - ptrdiff_t len = strlen (it->ai_canonname); - if (hostname_size <= len) - { - hostname_size = len + 1; - hostname = hostname_alloc = xrealloc (hostname_alloc, - hostname_size); - } - strcpy (hostname, it->ai_canonname); - } - freeaddrinfo (res); - } -#else /* !HAVE_GETADDRINFO */ - struct hostent *hp; - for (count = 0;; count++) - { - -#ifdef TRY_AGAIN - h_errno = 0; -#endif - hp = gethostbyname (hostname); -#ifdef TRY_AGAIN - if (! (hp == 0 && h_errno == TRY_AGAIN)) -#endif - - break; - - if (count >= 5) - break; - Fsleep_for (make_number (1), Qnil); - } - - if (hp) - { - char *fqdn = (char *) hp->h_name; - - if (!strchr (fqdn, '.')) - { - /* We still don't have a fully qualified domain name. - Try to find one in the list of alternate names */ - char **alias = hp->h_aliases; - while (*alias - && (!strchr (*alias, '.') - || !strcmp (*alias, "localhost.localdomain"))) - alias++; - if (*alias) - fqdn = *alias; - } - hostname = fqdn; - } -#endif /* !HAVE_GETADDRINFO */ - } -#endif /* HAVE_SOCKETS */ #endif /* HAVE_GETHOSTNAME */ char *p; for (p = hostname; *p; p++) commit f9acac751d4cd22480e62cc63936b1208ca9fe48 Author: Paul Eggert Date: Mon Dec 29 12:37:53 2014 -0800 system-name's returned value can vary Also, the system-name variable is now obsolete. Fixes Bug#19438. * doc/lispref/os.texi (System Environment): * etc/NEWS: Document this. * doc/misc/efaq.texi: (Displaying the current file name in the titlebar): * lisp/desktop.el (desktop-save-frameset): * lisp/dnd.el (dnd-get-local-file-uri): * lisp/gnus/message.el (message-make-fqdn): * lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers) (nnvirtual-update-xref-header): * lisp/nxml/rng-uri.el (rng-uri-file-name-1): * lisp/org/org-clock.el (org-clock-save): * src/filelock.c (current_lock_owner): * src/xrdb.c (get_environ_db): * src/xterm.c (same_x_server): * src/xterm.c (x_term_init): Prefer (system-name) to system-name, and avoid naming locals 'system-name'. * doc/misc/smtpmail.texi (Server workarounds): Fix grammar. * lisp/startup.el (system-name): Now an obsolete variable. * src/editfns.c (cached_system_name): New static var. (init_and_cache_system_name): New function. (init_editfns, Fsystem_name): Use it. (syms_of_editfns): Initialize it and Vsystem_name to the same value. * src/sysdep.c [HAVE_SOCKETS]: Don't include , . (h_errno) [TRY_AGAIN && !HAVE_H_ERRNO]: Remove decl. (init_system_name) [HAVE_SOCKETS]: Don't canonicalize the name. Don't create a new string if the current value is already correct. diff --git a/ChangeLog b/ChangeLog index 00775ed..1fc7d66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2014-12-29 Paul Eggert + + system-name's returned value can vary + Fixes Bug#19438. + * doc/lispref/os.texi (System Environment): + * etc/NEWS: Document this. + * doc/misc/efaq.texi: + (Displaying the current file name in the titlebar): + * lisp/desktop.el (desktop-save-frameset): + * lisp/dnd.el (dnd-get-local-file-uri): + * lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers) + (nnvirtual-update-xref-header): + * lisp/nxml/rng-uri.el (rng-uri-file-name-1): + * lisp/org/org-clock.el (org-clock-save): + * src/filelock.c (current_lock_owner): + * src/xrdb.c (get_environ_db): + * src/xterm.c (same_x_server): + * src/xterm.c (x_term_init): + Prefer (system-name) to system-name. + * doc/misc/smtpmail.texi (Server workarounds): Fix grammar. + * src/editfns.c (cached_system_name): New static var. + (init_and_cache_system_name): New function. + (init_editfns, Fsystem_name): Use it. + (syms_of_editfns): Initialize it and Vsystem_name to the same value. + * src/sysdep.c (init_system_name): Don't create a new string if + the current value is already correct. + 2014-12-28 Paul Eggert * build-aux/git-hooks/commit-msg: Allow tabs. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 1a6a031..1300bc7 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -918,10 +918,15 @@ string. @end defun The symbol @code{system-name} is a variable as well as a function. In -fact, the function returns whatever value the variable +fact, the function normally returns whatever value the variable @code{system-name} currently holds. Thus, you can set the variable @code{system-name} in case Emacs is confused about the name of your -system. The variable is also useful for constructing frame titles +system. If you do not set the variable, the function updates +the variable to the current system name; this behavior can be useful +if your Emacs process has changed systems or if the system has changed +names. + +The @code{system-name} variable is also useful for constructing frame titles (@pxref{Frame Titles}). @c FIXME seems like this section is not the best place for this option? diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 0159101..71c5ae0 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -1469,7 +1469,7 @@ machine at which Emacs was invoked. This is done by setting @code{frame-title-format} to the default value of @lisp -(multiple-frames "%b" ("" invocation-name "@@" system-name)) +(multiple-frames "%b" ("" invocation-name "@@" (system-name))) @end lisp To modify the behavior such that frame titlebars contain the buffer's diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi index f539cd0..9cddbfa 100644 --- a/doc/misc/smtpmail.texi +++ b/doc/misc/smtpmail.texi @@ -368,7 +368,7 @@ implement support for common requirements. @vindex smtpmail-local-domain The variable @code{smtpmail-local-domain} controls the hostname sent in the first @code{EHLO} or @code{HELO} command sent to the server. -It should only be set if the @code{system-name} function returns a +It should be set only if the @code{system-name} function returns a name that isn't accepted by the server. Do not set this variable unless your server complains. diff --git a/etc/NEWS b/etc/NEWS index 548f409..e5c988b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -541,6 +541,9 @@ optional repeat-count argument. ** Function `sort' can deal with vectors. +** Function `system-name' now returns an updated value if the current +system's name has changed, or if the Emacs process has changed systems. + --- ** New utilities in subr-x.el: *** New macros `if-let' and `when-let' allow defining bindings and to diff --git a/lisp/desktop.el b/lisp/desktop.el index bad0073..bcf0387 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -940,7 +940,7 @@ Frames with a non-nil `desktop-dont-save' parameter are not saved." (and desktop-restore-frames (frameset-save nil :app desktop--app-id - :name (concat user-login-name "@" system-name) + :name (concat user-login-name "@" (system-name)) :predicate #'desktop--check-dont-save)))) ;;;###autoload diff --git a/lisp/dnd.el b/lisp/dnd.el index 73b531d..2b68b02 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -122,17 +122,18 @@ Return nil if URI is not a local file." ;; The hostname may be our hostname, in that case, convert to a local ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? - (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) + (let ((system-name (system-name))) + (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) (downcase (match-string 1 uri)))) - (system-name-no-dot - (downcase (if (string-match "^[^\\.]+" system-name) - (match-string 0 system-name) - system-name)))) - (when (and hostname - (or (string-equal "localhost" hostname) - (string-equal (downcase system-name) hostname) - (string-equal system-name-no-dot hostname))) - (concat "file://" (substring uri (+ 7 (length hostname))))))) + (system-name-no-dot + (downcase (if (string-match "^[^\\.]+" system-name) + (match-string 0 system-name) + system-name)))) + (when (and hostname + (or (string-equal "localhost" hostname) + (string-equal (downcase system-name) hostname) + (string-equal system-name-no-dot hostname))) + (concat "file://" (substring uri (+ 7 (length hostname)))))))) (defsubst dnd-unescape-uri (uri) (replace-regexp-in-string diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index f67943a..d13b492 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -151,7 +151,7 @@ component group will show up when you enter the virtual group.") ;; and clean up the xrefs. (princ article nntp-server-buffer) (nnvirtual-update-xref-header cgroup carticle - prefix system-name) + prefix (system-name)) (forward-line 1)) ) @@ -393,7 +393,7 @@ component group will show up when you enter the virtual group.") (forward-char -1) (delete-char 1)) - (insert "Xref: " system-name " " group ":") + (insert "Xref: " (system-name) " " group ":") (princ article (current-buffer)) (insert " ") diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index b93624a..43218ec 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -85,7 +85,7 @@ Signal an error if URI is not a valid file URL." ((not (string= (downcase scheme) "file")) (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) (when (not (member authority - (cons system-name '(nil "" "localhost")))) + (cons (system-name) '(nil "" "localhost")))) (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" uri)) (when query diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 51c8789..c928758 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -2811,8 +2811,8 @@ The details of what will be saved are regulated by the variable (delete-region (point-min) (point-max)) ;;Store clock (insert (format ";; org-persist.el - %s at %s\n" - system-name (format-time-string - (cdr org-time-stamp-formats)))) + (system-name) (format-time-string + (cdr org-time-stamp-formats)))) (if (and (memq org-clock-persist '(t clock)) (setq b (org-clocking-buffer)) (setq b (or (buffer-base-buffer b) b)) diff --git a/src/editfns.c b/src/editfns.c index 430c4c9..2a7dd92 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -93,6 +93,17 @@ static char const *initial_tz; It is OK (though a bit slower) if the user chooses this value. */ static char dump_tz_string[] = "TZ=UtC0"; +/* The cached value of Vsystem_name. This is used only to compare it + to Vsystem_name, so it need not be visible to the GC. */ +static Lisp_Object cached_system_name; + +static void +init_and_cache_system_name (void) +{ + init_system_name (); + cached_system_name = Vsystem_name; +} + void init_editfns (void) { @@ -102,7 +113,7 @@ init_editfns (void) Lisp_Object tem; /* Set up system_name even when dumping. */ - init_system_name (); + init_and_cache_system_name (); #ifndef CANNOT_DUMP /* When just dumping out, set the time zone to a known unlikely value @@ -1365,6 +1376,8 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, doc: /* Return the host name of the machine you are running on, as a string. */) (void) { + if (EQ (Vsystem_name, cached_system_name)) + init_and_cache_system_name (); return Vsystem_name; } @@ -4965,6 +4978,7 @@ functions if all the text being accessed has this property. */); DEFVAR_LISP ("system-name", Vsystem_name, doc: /* The host name of the machine Emacs is running on. */); + Vsystem_name = cached_system_name = Qnil; DEFVAR_LISP ("user-full-name", Vuser_full_name, doc: /* The full name of the user logged in. */); diff --git a/src/filelock.c b/src/filelock.c index f857c48..99215f2 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -592,9 +592,10 @@ current_lock_owner (lock_info_type *owner, char *lfname) return -1; /* On current host? */ - if (STRINGP (Vsystem_name) - && dot - (at + 1) == SBYTES (Vsystem_name) - && memcmp (at + 1, SSDATA (Vsystem_name), SBYTES (Vsystem_name)) == 0) + Lisp_Object system_name = Fsystem_name (); + if (STRINGP (system_name) + && dot - (at + 1) == SBYTES (system_name) + && memcmp (at + 1, SSDATA (system_name), SBYTES (system_name)) == 0) { if (pid == getpid ()) ret = 2; /* We own it. */ diff --git a/src/sysdep.c b/src/sysdep.c index 24cc5cb..b4a9be1 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1420,15 +1420,16 @@ extern int h_errno; void init_system_name (void) { + char *hostname_alloc = NULL; + char *hostname; #ifndef HAVE_GETHOSTNAME struct utsname uts; uname (&uts); - Vsystem_name = build_string (uts.nodename); + hostname = uts.nodename; #else /* HAVE_GETHOSTNAME */ - char *hostname_alloc = NULL; char hostname_buf[256]; ptrdiff_t hostname_size = sizeof hostname_buf; - char *hostname = hostname_buf; + hostname = hostname_buf; /* Try to get the host name; if the buffer is too short, try again. Apparently, the only indication gethostname gives of @@ -1541,15 +1542,15 @@ init_system_name (void) #endif /* !HAVE_GETADDRINFO */ } #endif /* HAVE_SOCKETS */ - Vsystem_name = build_string (hostname); - xfree (hostname_alloc); #endif /* HAVE_GETHOSTNAME */ - { - char *p; - for (p = SSDATA (Vsystem_name); *p; p++) - if (*p == ' ' || *p == '\t') - *p = '-'; - } + char *p; + for (p = hostname; *p; p++) + if (*p == ' ' || *p == '\t') + *p = '-'; + if (! (STRINGP (Vsystem_name) && SBYTES (Vsystem_name) == p - hostname + && strcmp (SSDATA (Vsystem_name), hostname) == 0)) + Vsystem_name = build_string (hostname); + xfree (hostname_alloc); } sigset_t empty_mask; diff --git a/src/xrdb.c b/src/xrdb.c index e21206d..8500fb1 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -385,10 +385,11 @@ get_environ_db (void) { char *home = gethomedir (); ptrdiff_t homelen = strlen (home); + Lisp_Object system_name = Fsystem_name (); ptrdiff_t filenamesize = (homelen + sizeof xdefaults - + SBYTES (Vsystem_name)); + + SBYTES (system_name)); p = filename = xrealloc (home, filenamesize); - lispstpcpy (stpcpy (filename + homelen, xdefaults), Vsystem_name); + lispstpcpy (stpcpy (filename + homelen, xdefaults), system_name); } db = XrmGetFileDatabase (p); diff --git a/src/xterm.c b/src/xterm.c index 130174d..892562b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10497,8 +10497,9 @@ static bool same_x_server (const char *name1, const char *name2) { bool seen_colon = false; - const char *system_name = SSDATA (Vsystem_name); - ptrdiff_t system_name_length = SBYTES (Vsystem_name); + Lisp_Object sysname = Fsystem_name (); + const char *system_name = SSDATA (sysname); + ptrdiff_t system_name_length = SBYTES (sysname); ptrdiff_t length_until_period = 0; while (system_name[length_until_period] != 0 @@ -10890,14 +10891,15 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) #endif lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@"; - if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name)) + Lisp_Object system_name = Fsystem_name (); + if (lim - SBYTES (Vinvocation_name) < SBYTES (system_name)) memory_full (SIZE_MAX); dpyinfo->x_id = ++x_display_id; dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) - + SBYTES (Vsystem_name) + 2); + + SBYTES (system_name) + 2); char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name); *nametail++ = '@'; - lispstpcpy (nametail, Vsystem_name); + lispstpcpy (nametail, system_name); /* Figure out which modifier bits mean what. */ x_find_modifier_meanings (dpyinfo); commit ce1ebdf1ba8acc75e8f959f414652cdc87e76401 Author: Dmitry Gutov Date: Mon Dec 29 17:04:51 2014 +0200 Update ChangeLog for the latest menu-bar.el change diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 64ead04..7bfc38c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-29 Dmitry Gutov + + * menu-bar.el (menu-bar-next-tag-other-window) + (menu-bar-next-tag): Remove. + 2014-12-29 K. Handa * international/mule.el (make-translation-table-from-alist): commit bb5e7861593815f912c21b2aee1e4be9a6cc64a2 Merge: 3fa5f44 8e0b270 Author: K. Handa Date: Mon Dec 29 22:54:07 2014 +0900 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs. commit 3fa5f4416ed219688b9d0e370edf40dce15a5de3 Author: K. Handa Date: Mon Dec 29 22:39:38 2014 +0900 international/mule.el (make-translation-table-from-alist): Accept nil or zero-length vector for FROM and TO. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 193e0c0..48c73bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-29 K. Handa + + * international/mule.el (make-translation-table-from-alist): + Accept nil or zero-length vector for FROM and TO. + 2014-12-28 Ivan Shmakov * net/shr.el (shr-tag-table): Fix handling of tbody/header/footer diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 4f8d50c..fd527b1 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -2317,7 +2317,13 @@ ALIST is an alist, each element has the form (FROM . TO). FROM and TO are a character or a vector of characters. If FROM is a character, that character is translated to TO. If FROM is a vector of characters, that sequence is translated to TO. -The first extra-slot of the value is a translation table for reverse mapping." +The first extra-slot of the value is a translation table for reverse mapping. + +FROM and TO may be nil. If TO is nil, the translation from FROM +to nothing is defined in the translation table and that element +is ignored in the reverse map. If FROM is nil, the translation +from TO to nothing is defined in the reverse map only. A vector +of length zero has the same meaning as specifying nil." (let ((tables (vector (make-char-table 'translation-table) (make-char-table 'translation-table))) table max-lookup from to idx val) @@ -2330,20 +2336,23 @@ The first extra-slot of the value is a translation table for reverse mapping." (setq from (cdr elt) to (car elt))) (if (characterp from) (setq idx from) - (setq idx (aref from 0) - max-lookup (max max-lookup (length from)))) - (setq val (aref table idx)) - (if val - (progn - (or (consp val) - (setq val (list (cons (vector idx) val)))) - (if (characterp from) - (setq from (vector from))) - (setq val (nconc val (list (cons from to))))) - (if (characterp from) - (setq val to) - (setq val (list (cons from to))))) - (aset table idx val)) + (if (= (length from) 0) + (setq idx nil) + (setq idx (aref from 0) + max-lookup (max max-lookup (length from))))) + (when idx + (setq val (aref table idx)) + (if val + (progn + (or (consp val) + (setq val (list (cons (vector idx) val)))) + (if (characterp from) + (setq from (vector from))) + (setq val (nconc val (list (cons from to))))) + (if (characterp from) + (setq val to) + (setq val (list (cons from to))))) + (aset table idx val))) (set-char-table-extra-slot table 1 max-lookup)) (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) (aref tables 0))) commit 8e0b2702ce8ad593a2098ae8028728ed137fb26c Author: Lars Ingebrigtsen Date: Mon Dec 29 13:04:25 2014 +0000 lisp/gnus/gnus-cloud.el: Start collecting a newsrc diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index ec016ee..a42bcc0 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el @@ -329,6 +329,15 @@ (defun gnus-cloud-server-p (server) (member server gnus-cloud-covered-servers)) +(defun gnus-cloud-collect-full-newsrc () + (let ((infos nil)) + (dolist (info (cdr gnus-newsrc-alist)) + (when (gnus-cloud-server-p + (gnus-method-to-server + (gnus-find-method-for-group (gnus-info-group info)))) + (push info infos))) + )) + (provide 'gnus-cloud) ;;; gnus-cloud.el ends here commit c5a81fdb6fc2422807674c2d7b27f8333a3b9e12 Author: Lars Ingebrigtsen Date: Mon Dec 29 13:47:43 2014 +0100 Make eww rendering default to `window-width' again * lisp/gnus/mm-decode.el (mm-shr): Bind `shr-width' to `fill-column' so that lines don't get overlong when responding. * lisp/net/eww.el (eww-mode): Truncate overlong lines for prettier display when resizing. * lisp/net/shr.el (shr-width): Default to using the window width when rendering. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1d2aa9b..82608b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-12-29 Lars Ingebrigtsen + + * net/eww.el (eww-mode): Truncate overlong lines for prettier + display when resizing. + + * net/shr.el (shr-width): Default to using the window width when + rendering. + 2014-12-29 Dmitry Gutov Unbreak jumping to an alias's definition. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6f0ea0f..0007b15 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2014-12-29 Lars Ingebrigtsen + + * mm-decode.el (mm-shr): Bind `shr-width' to `fill-column' so that + lines don't get overlong when responding. + 2014-12-18 Paul Eggert * registry.el (registry-db): Set default slot later. diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index f5b4d7c..3913ecc 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1814,6 +1814,7 @@ If RECURSIVE, search recursively." ;; Require since we bind its variables. (require 'shr) (let ((article-buffer (current-buffer)) + (shr-width fill-column) (shr-content-function (lambda (id) (let ((handle (mm-get-content-id id))) (when handle diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 9d787d3..b43dba5 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -705,6 +705,7 @@ the like." (setq-local tool-bar-map eww-tool-bar-map)) ;; desktop support (setq-local desktop-save-buffer 'eww-desktop-misc-data) + (setq truncate-lines t) (buffer-disable-undo) (setq buffer-read-only t)) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 26bb292..6553fd3 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -78,11 +78,12 @@ If nil, don't draw horizontal table lines." :group 'shr :type 'character) -(defcustom shr-width fill-column +(defcustom shr-width nil "Frame width to use for rendering. May either be an integer specifying a fixed width in characters, or nil, meaning that the full width of the window should be used." + :version "25.1" :type '(choice (integer :tag "Fixed width in characters") (const :tag "Use the width of the window" nil)) :group 'shr) commit d7e858bcc6f353ea3e955ca2a91d7b5c33bb6611 Author: Ulrich Müller Date: Mon Dec 29 11:20:50 2014 +0100 CONTRIBUTE: Use consistent spelling for 'ChangeLog'. diff --git a/CONTRIBUTE b/CONTRIBUTE index 3bc49cf..0e019d3 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE @@ -57,7 +57,7 @@ following modifications: the rationale for a change; that can be done in the commit message between the summary line and the file entries. -** Changelog notes +** ChangeLog notes - Emacs generally follows the GNU coding standards when it comes to ChangeLogs: @@ -67,7 +67,7 @@ following modifications: now), because `...' is so widely used elsewhere in Emacs. - Some of the rules in the GNU coding standards section 5.2 - "Commenting Your Work" also apply to Changelog entries: they must be + "Commenting Your Work" also apply to ChangeLog entries: they must be in English, and be complete sentences starting with a capital and ending with a period (except the summary line should not end in a period).