emacs-diffs
[Top][All Lists]
Advanced

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

master 215d9fc: Merge from origin/emacs-27


From: Glenn Morris
Subject: master 215d9fc: Merge from origin/emacs-27
Date: Thu, 16 Jan 2020 10:55:06 -0500 (EST)

branch: master
commit 215d9fcb79b6ec3c241f58fdff02bf15fb952d0c
Merge: 0f4fa00 52080b5
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Merge from origin/emacs-27
    
    52080b5778 (origin/emacs-27) * lisp/minibuffer.el (read-file-name-def...
    e4cec1fd10 ; * etc/NEWS: Fix some file name quotations.
    13995f31a2 Make emacs prefer an existing ~/.emacs.d to an existing XD...
    91cac24952 ; etc/NEWS minor edits
    5505babc07 Describe --with-cairo non-support for bitmapped fonts.
    caf00066ee Mention GTK font chooser changes in NEWS
    23b87db628 ; Unmaintain fortran elisp
    3b0d1a50aa f90: handle F2008 module function
    55803cc189 Move shell-related menu items to "Shell Commands" submenu ...
    2be48605c0 * admin/notes/font-backend: Remove outdated file. (Bug#34663)
    f07a470124 Declare the ftx font backend driver obsolete
    6c08a430fb ; Fix wording of a comment.
    
    # Conflicts:
    #   admin/notes/font-backend
    #   etc/NEWS
---
 doc/emacs/custom.texi            |  45 ++++++++------
 etc/NEWS.27                      | 129 ++++++++++++++++++++++-----------------
 lib-src/emacsclient.c            |  17 +++---
 lisp/menu-bar.el                 |  33 +++++++---
 lisp/minibuffer.el               |   9 ++-
 lisp/progmodes/f90.el            |  19 ++++--
 lisp/progmodes/fortran.el        |   2 +-
 lisp/startup.el                  |  42 ++++++-------
 nt/inc/ms-w32.h                  |   4 +-
 test/lisp/progmodes/f90-tests.el |  20 ++++++
 10 files changed, 200 insertions(+), 120 deletions(-)

diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1958a86..2e04a6b 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.27 b/etc/NEWS.27
index cea5d50..d6eb5d9 100644
--- a/etc/NEWS.27
+++ b/etc/NEWS.27
@@ -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.
@@ -66,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 to specify a
-non-default '.pdmp' file to load the state from; see the node
+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.
 
 An Emacs started via a dump file can create a new dump file only if it
@@ -150,29 +153,32 @@ 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
 
 +++
-** 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.
@@ -217,7 +223,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.)
 
 
@@ -308,6 +314,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
@@ -434,7 +449,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'.
 
 +++
@@ -464,7 +479,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'.
 
@@ -534,7 +549,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
@@ -580,14 +595,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
@@ -717,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
@@ -763,9 +778,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
@@ -1268,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
 
@@ -1395,7 +1410,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.
 
 ---
@@ -1460,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
 
@@ -1507,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
@@ -1909,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.
 
 +++
@@ -2048,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.
 
 +++
@@ -2074,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.
 
 +++
@@ -2083,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
@@ -2095,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
@@ -2295,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.
 
 ---
@@ -2342,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.)
 
@@ -3024,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'
@@ -3043,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.
 
 +++
@@ -3233,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.
 
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 645ff04..204064f 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/menu-bar.el b/lisp/menu-bar.el
index 90f9ef7..8f825a1 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"))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a8b2a98..4831bf7 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.
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index 92fba1c..22f1cfd 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 <address@hidden>
-;; Maintainer: Glenn Morris <address@hidden>
+;; Maintainer: address@hidden
 ;; Keywords: fortran, f90, languages
 
 ;; This file is part of GNU Emacs.
@@ -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/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index b7e9e78..811951e 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -4,7 +4,7 @@
 ;; Inc.
 
 ;; Author: Michael D. Prange <address@hidden>
-;; Maintainer: Glenn Morris <address@hidden>
+;; Maintainer: address@hidden
 ;; Keywords: fortran, languages
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/startup.el b/lisp/startup.el
index 2a85c00..1f545c6 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.
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 3b1d3ff..1cce2c3 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -63,8 +63,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    Look in <sys/time.h> 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
diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el
index 540082c..b6fbac3 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



reply via email to

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