From 6c08a430fba529b81fdad79577dd673f49e6e56a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 15 Jan 2020 18:28:44 +0200 Subject: [PATCH 01/12] ; Fix wording of a comment. * nt/inc/ms-w32.h (BROKEN_DATAGRAM_SOCKETS): Fix wording of commentary. --- nt/inc/ms-w32.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 6d20c959a3f..4693900f2dc 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -63,8 +63,8 @@ along with GNU Emacs. If not, see . */ Look in for a timeval structure. */ #define HAVE_TIMEVAL 1 -/* And the select implementation does 1-byte read-ahead waiting - for received packets, so datagrams are broken too. */ +/* Our select emulation does 1-byte read-ahead waiting for received + packets, so datagrams are broken. */ #define BROKEN_DATAGRAM_SOCKETS 1 #define MAIL_USE_SYSTEM_LOCK 1 From f07a47012486d742525a6a5f21a61ca3cade3330 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 15 Jan 2020 19:20:38 +0100 Subject: [PATCH 02/12] Declare the ftx font backend driver obsolete * etc/NEWS: Document that the ftx font driver is now obsolete and will be removed in Emacs 28. (Bug#34663) --- etc/NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index cea5d500c7c..ec09a13259d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -150,6 +150,10 @@ builds respectively. Pass '--without-modules' to 'configure' to disable dynamic module support. +--- +** The ftx font backend driver is now obsolete and will be removed in +Emacs 28. + * Startup Changes in Emacs 27.1 From 2be48605c0e31566401853a405dc7ea1892b3ef7 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 15 Jan 2020 20:01:25 +0100 Subject: [PATCH 03/12] * admin/notes/font-backend: Remove outdated file. (Bug#34663) --- admin/notes/font-backend | 69 ---------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 admin/notes/font-backend diff --git a/admin/notes/font-backend b/admin/notes/font-backend deleted file mode 100644 index 7572182a844..00000000000 --- a/admin/notes/font-backend +++ /dev/null @@ -1,69 +0,0 @@ -Copyright (C) 2002-2020 Free Software Foundation, Inc. -See the end of the file for license conditions. - - -New font handling mechanism with font backend method ----------------------------------------------------- - -The new files are: - font.h -- header providing font-backend related structures - (most important ones are "struct font" and "struct - font_driver"), macros, and etc. - font.c -- main font handling code. - xfont.c -- font-driver on X for X core fonts. - ftfont.c -- generic font-driver for FreeType fonts providing - device-independent methods of struct font_driver. - xftfont.c -- font-driver on X using Xft for FreeType fonts - utilizing methods provided by ftfont.c. - ftxfont.c -- font-driver on X directly using FreeType fonts - utilizing methods provided by ftfont.c. - w32font.c -- font driver on w32 using Windows native fonts, - corresponding to xfont.c - w32uniscribe.c -- font driver on w32, using the uniscribe API - to provide complex script support for opentype fonts on - Windows 2000 and later, or earlier versions of Windows - with uniscribe installed as an add-on. - -So we already have codes for X and w32. For Mac it seems that we need -these files: - atmfont.c -- font-driver on mac using ATM fonts, corresponding - to xfont.c -As BDF fonts are currently used on w32, we may also implement these: - bdffont.c -- generic font-driver for BDF fonts, corresponding to - ftfont.c - bdfw32font.c -- font-driver on w32 using BDF fonts, - corresponding to ftxfont.c -But, as FreeType already supports BDF fonts, if FreeType and -Fontconfig are also available on w32, what we need may be: - ftw32font.c -- font-driver on w32 directly using FreeType fonts - utilizing methods provided by ftfont.c. - -It may be interesting if Emacs supports a frame buffer directly and -has these font driver. - ftfbfont.c -- font-driver on FB for FreeType fonts. - bdffbfont.c -- font-driver on FB for BDF fonts. - -Note: The fontset related codes are not yet matured to work well with -the font backend method. So, for instance, even if you start Emacs -as something like this: - % emacs -fn tahoma -Non-ASCII Latin characters will not be displayed by the font "tahoma". -In such a case, please try this: - -(set-fontset-font "fontset-default" 'latin '("tahoma" . "unicode-bmp")) - - -This file is part of GNU Emacs. - -GNU Emacs is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -GNU Emacs is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Emacs. If not, see . From 55803cc189a89031bbf2b37e5ac00a04ef1ad8aa Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 16 Jan 2020 01:30:33 +0200 Subject: [PATCH 04/12] Move shell-related menu items to "Shell Commands" submenu (bug#37594) * lisp/menu-bar.el (menu-bar-shell-commands-menu): New variable. (menu-bar-tools-menu): Move shell-related menu items to 'menu-bar-shell-commands-menu' and add menu items for 'async-shell-command' and 'shell'. --- lisp/menu-bar.el | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 90f9ef78c59..8f825a19adc 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1649,6 +1649,27 @@ mail status in mode line")) menu)) +(defvar menu-bar-shell-commands-menu + (let ((menu (make-sparse-keymap "Shell Commands"))) + (bindings--define-key menu [interactive-shell] + '(menu-item "Run Shell Interactively" shell + :help "Run a subshell interactively")) + + (bindings--define-key menu [async-shell-command] + '(menu-item "Async Shell Command..." async-shell-command + :help "Invoke a shell command asynchronously in background")) + + (bindings--define-key menu [shell-on-region] + '(menu-item "Shell Command on Region..." shell-command-on-region + :enable mark-active + :help "Pass marked region to a shell command")) + + (bindings--define-key menu [shell] + '(menu-item "Shell Command..." shell-command + :help "Invoke a shell command and catch its output")) + + menu)) + (defun menu-bar-read-mail () "Read mail using `read-mail-command'." (interactive) @@ -1740,16 +1761,14 @@ mail status in mode line")) (bindings--define-key menu [gdb] '(menu-item "Debugger (GDB)..." gdb :help "Debug a program from within Emacs with GDB")) - (bindings--define-key menu [shell-on-region] - '(menu-item "Shell Command on Region..." shell-command-on-region - :enable mark-active - :help "Pass marked region to a shell command")) - (bindings--define-key menu [shell] - '(menu-item "Shell Command..." shell-command - :help "Invoke a shell command and catch its output")) (bindings--define-key menu [compile] '(menu-item "Compile..." compile :help "Invoke compiler or Make, view compilation errors")) + + (bindings--define-key menu [shell-commands] + `(menu-item "Shell Commands" + ,menu-bar-shell-commands-menu)) + (bindings--define-key menu [rgrep] '(menu-item "Recursive Grep..." rgrep :help "Interactively ask for parameters and search recursively")) From 3b0d1a50aa7e7555d46c6a6b54840c9fb46a6810 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 15 Jan 2020 18:47:51 -0800 Subject: [PATCH 05/12] f90: handle F2008 module function * lisp/progmodes/f90.el (f90-font-lock-keywords-1) (f90-looking-at-program-block-start): Handle F2008 "module function" and subroutine. (Bug#38415) * test/lisp/progmodes/f90-tests.el (f90-test-bug38415): New test. --- lisp/progmodes/f90.el | 17 ++++++++++++----- test/lisp/progmodes/f90-tests.el | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 92fba1c53bb..9f61b8a6fca 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -539,8 +539,10 @@ type-name parts, respectively." read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t)) ;; Other functions and declarations. Named interfaces = F2003. ;; F2008: end submodule submodule_name. - '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\\(?:sub\\)?module\\|\ -function\\|associate\\|subroutine\\|interface\\)\\|use\\|call\\)\ + ;; F2008: module function|subroutine NAME. + '("\\_<\\(\\(?:end[ \t]*\\)?\\(program\\|\ +\\(?:module[ \t]*\\)?\\(?:function\\|subroutine\\)\\|\ +\\(?:sub\\)?module\\|associate\\|interface\\)\\|use\\|call\\)\ \\_>[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?" (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) ;; F2008: submodule (parent_name) submodule_name. @@ -1381,14 +1383,19 @@ write\\)[ \t]*([^)\n]*)") (cond ((looking-at "\\(program\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "module[ \t]*procedure\\_>")) + ((and (not (looking-at "module[ \t]*\\(procedure\\|function\\|subroutine\\)\\_>")) (looking-at "\\(module\\)[ \t]+\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>")) (list (match-string 1) (match-string 2))) ((looking-at "\\(submodule\\)[ \t]*([^)\n]+)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>") (list (match-string 1) (match-string 2))) - ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) - (looking-at "[^!'\"&\n]*\\(function\\|subroutine\\)[ \t]+\ + ((and (not (looking-at "end[ \t]*\\(function\\|procedure\\|subroutine\\)")) + (looking-at "[^!'\"&\n]*\\(?:module[ \t]*\\)?\ +\\(function\\|subroutine\\)[ \t]+\ \\(\\(?:\\sw\\|\\s_\\)+\\)")) + ;; TODO: In F2008 "module procedure foo" may or may not start a block, + ;; It is impossible to tell the difference without parsing state. +;;; (looking-at "[^!'\"&\n]*module[ \t]*\\(procedure\\)[ \t]+\ +;;;\\(\\(?:\\sw\\|\\s_\\)+\\)"))) (list (match-string 1) (match-string 2))))) ;; Following will match an un-named main program block; however ;; one needs to check if there is an actual PROGRAM statement after diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el index 540082c7174..b6fbac351dc 100644 --- a/test/lisp/progmodes/f90-tests.el +++ b/test/lisp/progmodes/f90-tests.el @@ -277,4 +277,24 @@ end program prog") (forward-line -2) (should (= 2 (current-indentation))))) ; type is +(ert-deftest f90-test-bug38415 () + "Test for https://debbugs.gnu.org/38415 ." + (with-temp-buffer + (f90-mode) + (setq-local f90-smart-end 'no-blink) + (insert "module function foo(x) +real :: x +end") + (f90-indent-line) + (should (equal " function foo" + (buffer-substring (point) (line-end-position)))) + (goto-char (point-max)) + (insert "\nmodule subroutine bar(x) +real :: x +end") + (f90-indent-line) + (should (equal " subroutine bar" + (buffer-substring (point) (line-end-position)))))) + + ;;; f90-tests.el ends here From 23b87db6286c7827c9d60a167bc1eee8f1296c3d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 15 Jan 2020 18:49:21 -0800 Subject: [PATCH 06/12] ; Unmaintain fortran elisp --- lisp/progmodes/f90.el | 2 +- lisp/progmodes/fortran.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 9f61b8a6fca..22f1cfd7c89 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1995-1997, 2000-2020 Free Software Foundation, Inc. ;; Author: Torbjörn Einarsson -;; Maintainer: Glenn Morris +;; Maintainer: emacs-devel@gnu.org ;; Keywords: fortran, f90, languages ;; This file is part of GNU Emacs. diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index b7e9e7857bc..811951eaaaf 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -4,7 +4,7 @@ ;; Inc. ;; Author: Michael D. Prange -;; Maintainer: Glenn Morris +;; Maintainer: emacs-devel@gnu.org ;; Keywords: fortran, languages ;; This file is part of GNU Emacs. From caf00066eec4cbfb905c52100cae7bf8d025d4b5 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 16 Jan 2020 10:33:01 +0100 Subject: [PATCH 07/12] Mention GTK font chooser changes in NEWS * etc/NEWS: Mention GTK font chooser changes. --- etc/NEWS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index ec09a13259d..a36a6b59efa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -312,6 +312,15 @@ causing XFT crashes, they are now filtered out. Setting require setting 'face-ignored-fonts' to filter out problematic fonts. Known problematic fonts are "Noto Color Emoji" and "Emoji One". +--- +** The GTK+ font chooser now respects 'face-ignored-fonts'. +When using 'menu-set-font' under GTK3, the available fonts are now +matched against 'face-ignored-fonts'. + +--- +** The GTK+ font chooser now remembers the previously selected settings. +It now remembers the name, size, style, etc. + +++ ** New user option 'what-cursor-show-names'. When non-nil, 'what-cursor-position' will show the name of the character From 5505babc0706bb949f35e2299762e592c62070ec Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 16 Jan 2020 10:34:37 +0100 Subject: [PATCH 08/12] Describe --with-cairo non-support for bitmapped fonts. * etc/NEWS: Mention Pango's removal of support for bitmapped fonts. --- etc/NEWS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index a36a6b59efa..12536574760 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,7 +56,10 @@ than their Lisp counterparts from json.el. ** The configure option '--with-cairo' is no longer experimental. This builds Emacs with Cairo drawing, and supports built-in printing when Emacs is built with GTK+. Some severe bugs in this build were -fixed, and we can therefore offer this to users without caveats. +fixed, and we can therefore offer this to users without caveats. Note +that building with Cairo enabled results in using Pango instead of +libXft for font support, and that Pango 1.44 has removed support for +bitmapped fonts. +++ ** Emacs now uses a "portable dumper" instead of unexec. From 91cac24952806c6c4addc3c045854c2c314c2e31 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 16 Jan 2020 10:39:40 +0100 Subject: [PATCH 09/12] ; etc/NEWS minor edits --- etc/NEWS | 61 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 12536574760..c1e00395c84 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -71,7 +71,7 @@ operating systems. When built with the portable dumping support (which is the default), Emacs looks for the 'emacs.pdmp' file, generated during the build, in its data directory at startup, and loads the dumped state from there. -The new command-line argument '--dump-file=FILE' allows to specify a +The new command-line argument '--dump-file=FILE' allows specifying a non-default '.pdmp' file to load the state from; see the node "(emacs) Initial Options" in the Emacs manual for more information. @@ -224,7 +224,7 @@ it won't work right without some adjustment: Units that are ordered after 'emacs.service' will only be started after Emacs has finished initialization and is ready for use. (If your Emacs is installed in a non-standard location and you copied the -emacs.service file to eg "~/.config/systemd/user/", you will need to copy +emacs.service file to e.g. "~/.config/systemd/user/", you will need to copy the new version of the file again.) @@ -450,7 +450,7 @@ from a remote host. +++ ** The function 'executable-find' supports an optional argument REMOTE. -This triggers to search the program on the remote host as indicated by +This triggers searching for the program on the remote host as indicated by 'default-directory'. +++ @@ -480,7 +480,7 @@ Customize 'switch-to-prev-buffer-skip' instead. +++ ** New user option 'switch-to-prev-buffer-skip'. -This user option allows to specify the set of buffers that may be +This user option allows specifying the set of buffers that may be shown by 'switch-to-prev-buffer' and 'switch-to-next-buffer' more stringently than the now obsolete 'switch-to-visible-buffer'. @@ -550,7 +550,7 @@ There are 2 new buffer local variables and 1 face to customize this mode, they are described in the manual "(emacs) Display". +++ -** 'progress-reporter-update' accepts a suffix string to display. +** 'progress-reporter-update' now accepts an optional suffix string to display. --- ** New user option 'xref-file-name-display' controls the display of @@ -596,14 +596,14 @@ if so, 'backup-by-copying-when-mismatch' will be forced on. * Editing Changes in Emacs 27.1 +++ -** When asked to visit a large file, Emacs now offers visiting it literally. +** When asked to visit a large file, Emacs now offers to visit it literally. Previously, Emacs would only ask for confirmation before visiting large files. Now it also offers a third alternative: to visit the file literally, as in 'find-file-literally', which speeds up navigation and editing of large files. +++ -** 'zap-to-char' now uses history of characters you used to zap to. +** 'zap-to-char' now uses the history of characters you used to zap to. 'zap-to-char' uses the new 'read-char-from-minibuffer' function to allow navigating through the history of characters that have been input. This is mostly useful for characters that have complex input methods @@ -779,9 +779,9 @@ mediawiki format tables. ** goto-addr -*** A way to more conveniently specify what URI address schemes that -should be ignored have been added via the -'goto-address-uri-schemes-ignored' variable. +*** A way to more conveniently specify what URI address schemes should +be ignored has been added via the 'goto-address-uri-schemes-ignored' +variable. +++ ** tex-mode @@ -1411,7 +1411,7 @@ where you can select a node to go back (like in browsers). *** Info can now follow 'file://' protocol URLs. The 'file://' URLs in Info documents can now be followed by passing them to the 'browse-url' function, like the other protocols: 'ftp', -'http', and 'https'. This allows to have references to local HTML +'http', and 'https'. This allows having references to local HTML files, for example. --- @@ -1523,8 +1523,9 @@ This feature can be enabled by setting the new 'nnimap-use-namespaces' server variable to non-nil. +++ -*** A prefix argument to 'gnus-summary-limit-to-score' will limit reverse. -Limit to articles with score at below. +*** A prefix argument to 'gnus-summary-limit-to-score' will limit in reverse. +Limit to articles with score "at or below" the SCORE argument rather +than "at or above". --- *** The function 'gnus-score-find-favorite-words' has been renamed @@ -1925,7 +1926,7 @@ The abbreviation can be disabled by the new user option ** ERT +++ -*** New variable 'ert-quiet' allows to make ERT output in batch mode +*** New variable 'ert-quiet' allows making ERT output in batch mode less verbose by removing non-essential information. +++ @@ -2064,21 +2065,21 @@ the real password is revealed (via 'reveal-mode'). The new ** Tramp +++ -*** New connection method "nextcloud", which allows to access OwnCloud +*** New connection method "nextcloud", which allows accessing OwnCloud or NextCloud hosted files and directories. +++ -*** New connection method "rclone", which allows to access system +*** New connection method "rclone", which allows accessing system storages via the 'rclone' program. This feature is experimental. +++ -*** New connection method "sudoedit", which allows to edit local files +*** New connection method "sudoedit", which allows editing local files with different user credentials. Contrary to the "sudo" method, no session is run permanently in the background. This is for security reasons. +++ -*** Connection methods "obex" and "synce" are removed, because they +*** Connection methods "obex" and "synce" have been removed, because they are obsoleted in GVFS. +++ @@ -2090,7 +2091,7 @@ from auth-source search are taken into account. This can be disabled by setting the user option 'tramp-completion-use-auth-sources' to nil. +++ -*** The user option 'tramp-ignored-file-name-regexp' allows to disable +*** The user option 'tramp-ignored-file-name-regexp' allows disabling Tramp for some look-alike remote file names. +++ @@ -2099,9 +2100,9 @@ multi-hop file names must match the previous hop. Default host names are adjusted to the host name from the previous hop. +++ -*** For the connection methods "sudo" and "doas" there exists a -timeout, after which the underlying session is disabled. This is for -security reasons. +*** A timeout has been added for the connection methods "sudo" and "doas". +The underlying session is disabled when the timeout expires. This is +for security reasons. +++ *** For some connection methods, like "sshx" or "plink", it is @@ -2111,7 +2112,7 @@ cooperates badly with Tramp. +++ *** New commands 'tramp-rename-files' and 'tramp-rename-these-files'. -They allow to save remote files somewhere else when the corresponding +They allow saving remote files somewhere else when the corresponding host is not reachable anymore. ** Rcirc @@ -2311,7 +2312,7 @@ expressions from simpler parts. +++ *** New value of 'minibuffer' frame parameter 'child-frame'. -This allows to create and parent immediately a minibuffer-only child +This allows creating and immediately parenting a minibuffer-only child frame when making a frame. --- @@ -3040,7 +3041,7 @@ years containing more than four digits. This is for compatibility with POSIX.1-2017. +++ -*** To access (or alter) the elements a decoded time value, the +*** To access (or alter) the elements of a decoded time value, the 'decoded-time-second', 'decoded-time-minute', 'decoded-time-hour', 'decoded-time-day', 'decoded-time-month', 'decoded-time-year', 'decoded-time-weekday', 'decoded-time-dst' and 'decoded-time-zone' @@ -3059,7 +3060,7 @@ elements as if it's midnight January 1st, 1970) have been added. if it is not known whether daylight saving time is in effect. Formerly they were inconsistent: 'encode-time' returned t in this situation, whereas 'parse-time-string' returned nil. Now they -consistently use use nil to mean that DST is not in effect, and use -1 +consistently use nil to mean that DST is not in effect, and use -1 to mean that it is not known whether DST is in effect. +++ @@ -3249,22 +3250,22 @@ reliably survive subsequent invocations of 'set-window-buffer'. +++ ** New user option 'resize-mini-frames'. -This option allows to automatically resize minibuffer-only frames +This option allows automatically resizing minibuffer-only frames similarly to how minibuffer windows are resized on "normal" frames. +++ ** New buffer display action function 'display-buffer-in-direction'. -This function allows to specify the location of the window chosen by +This function allows specifying the location of the window chosen by 'display-buffer' in various ways. +++ ** New buffer display action alist entry 'dedicated'. -Such an entry allows to specify the dedicated status of a window +Such an entry allows specifying the dedicated status of a window created by 'display-buffer'. +++ ** New buffer display action alist entry 'window-min-height'. -Such an entry allows to specify a minimum height of the window used +Such an entry allows specifying a minimum height of the window used for displaying a buffer. 'display-buffer-below-selected' is the only action function to respect it at the moment. From 13995f31a219bfcb24da5887136583cbf2deff4c Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Wed, 15 Jan 2020 12:24:43 +0100 Subject: [PATCH 10/12] Make emacs prefer an existing ~/.emacs.d to an existing XDG location * doc/emacs/custom.texi (Find Init): Update description of how Emacs finds its init file directory and the interaction with $XDG_CONFIG_HOME (Early Init File): Correct XDG location of early-init.el * etc/NEWS: Update description to make it clear the ~/.emacs.d is preferred, even if the XDG location exists. * lisp/startup.el: Prefer ~/.emacs.d even if the XDG location exists. * lib-src/emacsclient.c (open_config): Prefer home directory the XDG location. --- doc/emacs/custom.texi | 45 +++++++++++++++++++++++++++---------------- etc/NEWS | 31 +++++++++++++++-------------- lib-src/emacsclient.c | 17 ++++++++-------- lisp/startup.el | 42 ++++++++++++++++++++-------------------- 4 files changed, 73 insertions(+), 62 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 1958a86b92d..2e04a6b22d3 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2655,26 +2655,37 @@ library. @xref{Hooks}. Emacs normally finds your init file in a location under your home directory. @xref{Init File}. By default this location is -@file{~/.config/emacs/init.el} where @file{~/} stands for your home directory. +@file{~/.emacs.d/init.el} where @file{~/} stands for your home directory. This default can be overridden as described below. - If @env{XDG_CONFIG_HOME} is set in your environment, its -value replaces @file{~/.config} in the name of the default -init file. - - If the default init file's parent directory does not exist but the -directory @file{~/.emacs.d} does exist, Emacs looks for your init file +Emacs looks for your init file using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or @file{~/.emacs.d/init.el}; you can choose to use any one of these names. (Note that only the locations directly in your home directory -have a leading dot in the location's basename.) Although this is -backward-compatible with older Emacs versions, modern POSIX platforms -prefer putting your initialization files under @file{~/.config} so -that troubleshooting a problem that might be due to a bad init file, -or archiving a collection of init files, can be done by renaming that -directory. To help older Emacs versions find configuration files in -their current default locations, you can execute the following -Emacs Lisp code: +have a leading dot in the location's basename.) + +Emacs can also look in an XDG-compatible location for @file{init.el}, +the default is the directory @file{~/.config/emacs}. This can be +overriden by setting @env{XDG_CONFIG_HOME} in your environment, its +value replaces @file{~/.config} in the name of the default XDG init +file. However @file{~/.emacs.d} and @file{~/.emacs} are always +preferred if they exist, which means that you must delete or rename +them in order to use the XDG location. + +Note also that if neither the XDG location nor @file{~/.emacs.d} +exist, then Emacs will create @file{~/.emacs.d} (and therefore use it +during subsequent invocations). + +Emacs will set @var{user-emacs-directory} to the directory it decides +to use. + +Although this is backward-compatible with older Emacs versions, modern +POSIX platforms prefer putting your initialization files under +@file{~/.config} so that troubleshooting a problem that might be due +to a bad init file, or archiving a collection of init files, can be +done by renaming that directory. To help older Emacs versions find +configuration files in their current default locations, you can +execute the following Emacs Lisp code: @example (make-symbolic-link ".config/emacs" "~/.emacs.d") @@ -2694,7 +2705,7 @@ otherwise, it looks up the home directory corresponding to that user name in the system's data base of users. For brevity the rest of the Emacs documentation generally uses just -the current default location @file{~/.config/emacs/init.el} for the +the current default location @file{~/.emacs.d/init.el} for the init file. @c LocalWords: backtab @@ -2740,7 +2751,7 @@ Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}. @xref{Init File}. However, it is sometimes desirable to have customizations that take effect during Emacs startup earlier than the normal init file is processed. Such customizations can be put in the early -init file, @file{~/.config/emacs.d/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the +init file, @file{~/.config/emacs/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the package system and GUI is initialized, so in it you can customize variables that affect frame appearance as well as the package initialization process, such as @code{package-enable-at-startup}, @code{package-load-list}, and diff --git a/etc/NEWS b/etc/NEWS index c1e00395c84..38fff3f7568 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -161,25 +161,24 @@ Emacs 28. * Startup Changes in Emacs 27.1 +++ -** Emacs now uses the XDG convention for init files. -For example, it looks for init.el in "~/.config/emacs/init.el", and -similarly for other init files. +** Emacs can now use the XDG convention for init files. +The 'XDG_CONFIG_HOME' environment variable (which defaults to +"~/.config") specifies the XDG configuration parent directory. Emacs +checks for "init.el" and other configuration files inside the "emacs" +subdirectory of 'XDG_CONFIG_HOME', i.e. "$XDG_CONFIG_HOME/emacs/init.el" -The 'XDG_CONFIG_HOME' environment variable (which defaults to "~/.config") -specifies the parent directory of these and other configuration files, -and will override their traditional locations (the home directory, -"~/.emacs.d", etc.). +However, Emacs will still initially look for init files in their +traditional locations if "~/.emacs.d" or "~/.emacs" exist, even if +"$XDG_CONFIG_HOME/emacs" also exists. This means that you must delete +or rename any existing "~/.emacs.d" and "~/.emacs" to enable use of +the XDG directory. -Emacs will still look for init files in their traditional locations if -"$XDG_CONFIG_HOME/emacs" does not exist, but "~/.emacs.d" or -"~/.emacs" does exist, so invoking Emacs with XDG_CONFIG_HOME='/nowhere' -might be useful if your new-location init files are scrambled, or if -you want to force Emacs to ignore files under 'XDG_CONFIG_HOME' for -some other reason. +If "~/.emacs.d" does not exist, and Emacs has decided to use it +(i.e. "$XDG_CONFIG_HOME/emacs" does not exist), Emacs will create it. +Emacs will never create "$XDG_CONFIG_HOME/emacs". -If neither "$XDG_CONFIG_HOME/emacs" nor "~/.emacs.d" exist, Emacs will -now default to "$XDG_CONFIG_HOME/emacs", and will create that directory -and set 'user-emacs-directory' to point to it. +Whichever directory Emacs decides to use, it will set +'user-emacs-directory' to point to it. +++ ** Emacs can now be configured using an early init file. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 645ff04c6d4..204064f1871 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -924,21 +924,22 @@ open_config (char const *home, char const *xdg, char const *config_file) char *configname = xmalloc (max (xdgsubdirsize, homesubdirsizemax) + strlen (config_file)); FILE *config; - if (xdg || home) + + if (home) { - strcpy ((xdg - ? stpcpy (stpcpy (configname, xdg), "/emacs/server/") - : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")), - config_file); + strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"), + config_file); config = fopen (configname, "rb"); } else config = NULL; - if (! config && home) + if (! config && (xdg || home)) { - strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"), - config_file); + strcpy ((xdg + ? stpcpy (stpcpy (configname, xdg), "/emacs/server/") + : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")), + config_file); config = fopen (configname, "rb"); } diff --git a/lisp/startup.el b/lisp/startup.el index 2a85c004da1..1f545c66922 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -497,28 +497,28 @@ DIRS are relative." (defvar startup--xdg-config-home-emacs) ;; Return the name of the init file directory for Emacs, assuming -;; XDG-DIR is the XDG location and USER-NAME is the user name. -;; If USER-NAME is nil or "", use the current user. -;; Prefer the XDG location unless it does does not exist and the -;; .emacs.d location does exist. +;; XDG-DIR is the XDG location and USER-NAME is the user name. If +;; USER-NAME is nil or "", use the current user. Prefer the XDG +;; location only if the .emacs.d location does not exist. (defun startup--xdg-or-homedot (xdg-dir user-name) - (if (file-exists-p xdg-dir) - xdg-dir - (let ((emacs-d-dir (concat "~" user-name - (if (eq system-type 'ms-dos) - "/_emacs.d/" - "/.emacs.d/")))) - (if (or (file-exists-p emacs-d-dir) - (if (eq system-type 'windows-nt) - (if (file-directory-p (concat "~" user-name)) - (directory-files (concat "~" user-name) nil - "\\`[._]emacs\\(\\.elc?\\)?\\'")) - (file-exists-p (concat "~" init-file-user - (if (eq system-type 'ms-dos) - "/_emacs" - "/.emacs"))))) - emacs-d-dir - xdg-dir)))) + (let ((emacs-d-dir (concat "~" user-name + (if (eq system-type 'ms-dos) + "/_emacs.d/" + "/.emacs.d/")))) + (cond + ((or (file-exists-p emacs-d-dir) + (if (eq system-type 'windows-nt) + (if (file-directory-p (concat "~" user-name)) + (directory-files (concat "~" user-name) nil + "\\`[._]emacs\\(\\.elc?\\)?\\'")) + (file-exists-p (concat "~" init-file-user + (if (eq system-type 'ms-dos) + "/_emacs" + "/.emacs"))))) + emacs-d-dir) + ((file-exists-p xdg-dir) + xdg-dir) + (t emacs-d-dir)))) (defun normal-top-level () "Emacs calls this function when it first starts up. From e4cec1fd106b9bb04583c043facc65531031db9c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 16 Jan 2020 16:17:26 +0100 Subject: [PATCH 11/12] ; * etc/NEWS: Fix some file name quotations. --- etc/NEWS | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 38fff3f7568..d6eb5d9e666 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -69,10 +69,10 @@ Randomization (ASLR) feature, a security technique used by most modern operating systems. When built with the portable dumping support (which is the default), -Emacs looks for the 'emacs.pdmp' file, generated during the build, in +Emacs looks for the "emacs.pdmp" file, generated during the build, in its data directory at startup, and loads the dumped state from there. The new command-line argument '--dump-file=FILE' allows specifying a -non-default '.pdmp' file to load the state from; see the node +non-default ".pdmp" file to load the state from; see the node "(emacs) Initial Options" in the Emacs manual for more information. An Emacs started via a dump file can create a new dump file only if it @@ -732,7 +732,7 @@ non-nil. --- ** 'autoconf-mode' is now used instead of 'm4-mode' for the -acinclude.m4/aclocal.m4/acsite.m4 files. +"acinclude.m4" / "aclocal.m4" / "acsite.m4" files. --- ** On GNU/Linux, 'M-x battery' will now list all batteries, no matter @@ -1283,9 +1283,9 @@ embedding database passwords in your Emacs initialization. See the 'auth-source' module for complete documentation on the file formats. By default, the wallet file is expected to be in the -'user-emacs-directory', named 'sql-wallet' or '.sql-wallet', with -'.json' (JSON) or no (NETRC) suffix. Both file formats can optionally -be encrypted with GPG by adding an additional '.gpg' suffix. +'user-emacs-directory', named "sql-wallet" or ".sql-wallet", with +".json" (JSON) or no (NETRC) suffix. Both file formats can optionally +be encrypted with GPG by adding an additional ".gpg" suffix. ** Term @@ -1475,8 +1475,9 @@ completion facilities. This can be controlled by the new 'ecomplete-sort-predicate' user option. --- -*** The 'ecompleterc' file is now placed in "~/.emacs.d/ecompleterc" by default. -Of course it will still find it if you have it in "~/.ecompleterc". +*** The 'ecomplete-database-file' file is now placed in +"~/.emacs.d/ecompleterc" by default. Of course it will still find it +if you have it in "~/.ecompleterc". ** Gnus @@ -2358,7 +2359,7 @@ in a terminal frame. --- *** JSX syntax is now automatically detected and enabled. If a file imports Facebook's 'React' library, or if the file uses the -extension '.jsx', then various features supporting XML-like syntax +extension ".jsx", then various features supporting XML-like syntax will be supported in 'js-mode' and derivative modes. ('js-jsx-mode' no longer needs to be enabled.) From 52080b5778cbe535c331fa14539aecd88f2be0a0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 16 Jan 2020 10:18:15 -0500 Subject: [PATCH 12/12] * lisp/minibuffer.el (read-file-name-default): Fix bug#39057 --- lisp/minibuffer.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index a8b2a984c52..4831bf72e9d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2737,8 +2737,13 @@ See `read-file-name' for the meaning of the arguments." (unless dir (setq dir (or default-directory "~/"))) (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir))) (unless default-filename - (setq default-filename (if initial (expand-file-name initial dir) - buffer-file-name))) + (setq default-filename + (cond + ((null initial) buffer-file-name) + ;; Special-case "" because (expand-file-name "" "/tmp/") returns + ;; "/tmp" rather than "/tmp/" (bug#39057). + ((equal "" initial) dir) + (t (expand-file-name initial dir))))) ;; If dir starts with user's homedir, change that to ~. (setq dir (abbreviate-file-name dir)) ;; Likewise for default-filename.