1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

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)
This commit is contained in:
Thomas Fitzsimmons 2022-11-07 19:34:33 -05:00
parent 80c3fadfd5
commit 68e2a9cd92
4 changed files with 56 additions and 15 deletions

View file

@ -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

View file

@ -1964,6 +1964,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

View file

@ -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")

View file

@ -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)