summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@fitzsim.org>2022-11-07 19:34:33 -0500
committerThomas Fitzsimmons <fitzsim@fitzsim.org>2022-11-07 20:05:05 -0500
commit68e2a9cd92996dd55ff9599dc1bf99c70070cddb (patch)
tree6191bd9f200b18663a27c29d7a0e19e9b65eb4a7
parent80c3fadfd57ee797404c80b8e88371c53edecfe5 (diff)
downloademacs-68e2a9cd92996dd55ff9599dc1bf99c70070cddb.tar.gz
EUDC: Add eudc-ignore-options-file customization
* etc/NEWS (EUDC): Document eudc-ignore-options-file. * doc/misc/eudc.texi (The Server Hotlist): Likewise * lisp/net/eudc-vars.el (eudc-ignore-options-file): New variable. (eudc-options-file): Mention new variable. * lisp/net/eudc.el: Warn on load if eudc-ignore-options-file is set but the options file exists. (eudc-set-server): Support eudc-ignore-options-file. (eudc-bookmark-server): Likewise. (eudc-save-options): Likewise. (Bug#56154)
-rw-r--r--doc/misc/eudc.texi32
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/net/eudc-vars.el8
-rw-r--r--lisp/net/eudc.el24
4 files changed, 56 insertions, 15 deletions
diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi
index 0037ba78d3b..50e483057d3 100644
--- a/doc/misc/eudc.texi
+++ b/doc/misc/eudc.texi
@@ -916,13 +916,23 @@ in other places, like for example the body of the message.
@section The Server Hotlist
EUDC lets you maintain a list of frequently used servers so that you
-can easily switch from one to another. This hotlist appears in the
-@samp{Server} submenu. You select a server in this list by clicking on
-its name. You can add the current server to the list with the command
-@kbd{M-x eudc-bookmark-current-server}. The list is contained in the variable
-@code{eudc-server-hotlist} which is stored in and retrieved from the file
-designated by @code{eudc-options-file}. EUDC also provides a facility to
-edit the hotlist interactively (@pxref{The Hotlist Edit Buffer}).
+can easily switch from one to another. Most users should configure
+the hotlist via Customize, and store the configuration in the main
+Emacs initialization file. Configuring it dynamically can be
+confusing, particularly if the hotlist settings are saved to
+@code{eudc-options-file} automatically. @code{eudc-options-file} is
+historical and support for it is still maintained, but new EUDC users
+should set @code{eudc-ignore-options-file} to @code{t}.
+
+However, this hotlist also appears in the @samp{Server} submenu. You
+select a server in this list by clicking on its name. You can add the
+current server to the list with the command @kbd{M-x
+eudc-bookmark-current-server}. The list is contained in the variable
+@code{eudc-server-hotlist} which is stored in and retrieved from the
+file designated by @code{eudc-options-file}, or normal Emacs
+initialization if @code{eudc-ignore-options-file} is non-nil. EUDC
+also provides a facility to edit the hotlist interactively (@pxref{The
+Hotlist Edit Buffer}).
The hotlist is also used to make queries on multiple servers
successively (@pxref{Multi-server Queries}). The order in which the
@@ -937,6 +947,14 @@ Add @var{server} to the hotlist of servers
Add the current server to the hotlist of servers
@end deffn
+@defvar eudc-ignore-options-file
+If non-nil, then EUDC ignores @code{eudc-options-file} and warns or
+issues an error when an attempt is made to use it. Most users should
+set this, and keep their EUDC configuration in the main Emacs
+initialization file instead. The separate eudc-options file has
+created confusion for users in the past.
+@end defvar
+
@defvar eudc-options-file
The name of a file where EUDC stores its internal variables (the
hotlist and the current server). EUDC will try to load that file upon
diff --git a/etc/NEWS b/etc/NEWS
index 538e165feeb..60b2caccc84 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1965,6 +1965,13 @@ It narrows to the current node.
** EUDC
+++
+*** New user option 'eudc-ignore-options-file' that defaults to 'nil'
+The 'eudc-ignore-options-file' user option can be configured to ignore
+the 'eudc-options-file' (typically "~/.emacs.d/eudc-options"). Most
+users should configure this to 't' and put EUDC configuration in the
+main Emacs initialization file (".emacs" or "~/.emacs.d/init.el").
+
++++
*** 'eudc-expansion-overwrites-query' to 'eudc-expansion-save-query-as-kill'.
'eudc-expansion-overwrites-query' is renamed to
'eudc-expansion-save-query-as-kill' to reflect the actual behavior of
diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el
index dea17f34247..bb1f9d9f0f3 100644
--- a/lisp/net/eudc-vars.el
+++ b/lisp/net/eudc-vars.el
@@ -343,9 +343,15 @@ arguments that should be passed to the program."
:inline t
(string :tag "Argument")))))
+(defcustom eudc-ignore-options-file nil
+ "Ignore configuration in `eudc-options-file', if non-nil."
+ :type 'boolean
+ :version "29.1")
+
(defcustom eudc-options-file
(locate-user-emacs-file "eudc-options" ".eudc-options")
- "A file where the `servers' hotlist is stored."
+ "A file where the `servers' hotlist is stored.
+See `eudc-ignore-options-file'."
:type '(file :Tag "File Name:")
:version "25.1")
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 5f9e78fc7f3..8319c048e20 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -726,7 +726,8 @@ server for future sessions."
(if (called-interactively-p 'interactive)
(message "Current directory server is now %s (%s)" eudc-server eudc-protocol))
(if (null no-save)
- (eudc-save-options)))
+ (when (not eudc-ignore-options-file)
+ (eudc-save-options))))
;;;###autoload
(defun eudc-get-email (name &optional error)
@@ -1107,7 +1108,11 @@ queries the server for the existing fields and displays a corresponding form."
(error "%s:%s is already in the hotlist" protocol server)
(setq eudc-server-hotlist (cons (cons server protocol) eudc-server-hotlist))
(eudc-install-menu)
- (eudc-save-options)))
+ (if eudc-ignore-options-file
+ (warn "Not saving bookmark due to `eudc-ignore-options-file'\
+ customization. Instead, customize `eudc-server-hotlist' to include %s:%s"
+ protocol server)
+ (eudc-save-options))))
(defun eudc-bookmark-current-server ()
"Add current server to the EUDC `servers' hotlist."
@@ -1117,6 +1122,9 @@ queries the server for the existing fields and displays a corresponding form."
(defun eudc-save-options ()
"Save options to `eudc-options-file'."
(interactive)
+ (when eudc-ignore-options-file
+ (error "EUDC is configured to ignore the deprecated options file;\
+ see `eudc-ignore-options-file'"))
(with-current-buffer (find-file-noselect eudc-options-file t)
(goto-char (point-min))
;; delete the previous setq
@@ -1278,11 +1286,13 @@ queries the server for the existing fields and displays a corresponding form."
;;{{{ Load time initializations
;; Load the options file
-(if (and (not noninteractive)
- (and (locate-library eudc-options-file)
- (progn (message "") t)) ; Remove mode line message
- (not (featurep 'eudc-options-file)))
- (load eudc-options-file))
+(let ((library-file-path (locate-library eudc-options-file)))
+ (if (and (not noninteractive)
+ (and library-file-path
+ (progn (message "") t)) ; Remove mode line message
+ (not (featurep 'eudc-options-file))
+ (not eudc-ignore-options-file))
+ (load eudc-options-file)))
;; Install the full menu
(unless (featurep 'infodock)