[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105112: Allow using `customize-save-
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105112: Allow using `customize-save-variable' under Emacs -Q: Set the variable, and give a warning |
Date: |
Mon, 11 Jul 2011 22:12:07 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105112
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Mon 2011-07-11 22:12:07 +0200
message:
Allow using `customize-save-variable' under Emacs -Q: Set the variable, and
give a warning
modified:
lisp/ChangeLog
lisp/cus-edit.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-07-11 16:31:09 +0000
+++ b/lisp/ChangeLog 2011-07-11 20:12:07 +0000
@@ -1,3 +1,9 @@
+2011-07-11 Lars Magne Ingebrigtsen <address@hidden>
+
+ * cus-edit.el (custom-file): Take an optional no-error variable.
+ (customize-save-variable): Set the variable, and give a warning if
+ running under "emacs -q".
+
2011-07-11 Juanma Barranquero <address@hidden>
* loadhist.el (unload-feature-special-hooks):
=== modified file 'lisp/cus-edit.el'
--- a/lisp/cus-edit.el 2011-07-11 14:57:15 +0000
+++ b/lisp/cus-edit.el 2011-07-11 20:12:07 +0000
@@ -1033,7 +1033,11 @@
(put variable 'saved-variable-comment comment)))
(put variable 'customized-value nil)
(put variable 'customized-variable-comment nil)
- (custom-save-all)
+ (if (custom-file t)
+ (custom-save-all)
+ (message "Setting `%s' temporarily since \"emacs -q\" would overwrite
customizations"
+ variable)
+ (set variable value))
value)
;; Some parts of Emacs might prompt the user to save customizations,
@@ -4403,23 +4407,27 @@
if only the first line of the docstring is shown."))
:group 'customize)
-(defun custom-file ()
+(defun custom-file (&optional no-error)
"Return the file name for saving customizations."
- (file-chase-links
- (or custom-file
- (let ((user-init-file user-init-file)
- (default-init-file
- (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
- (when (null user-init-file)
- (if (or (file-exists-p default-init-file)
- (and (eq system-type 'windows-nt)
- (file-exists-p "~/_emacs")))
- ;; Started with -q, i.e. the file containing
- ;; Custom settings hasn't been read. Saving
- ;; settings there would overwrite other settings.
- (error "Saving settings from \"emacs -q\" would overwrite
existing customizations"))
- (setq user-init-file default-init-file))
- user-init-file))))
+ (let ((file
+ (or custom-file
+ (let ((user-init-file user-init-file)
+ (default-init-file
+ (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs")))
+ (when (null user-init-file)
+ (if (or (file-exists-p default-init-file)
+ (and (eq system-type 'windows-nt)
+ (file-exists-p "~/_emacs")))
+ ;; Started with -q, i.e. the file containing
+ ;; Custom settings hasn't been read. Saving
+ ;; settings there would overwrite other settings.
+ (if no-error
+ nil
+ (error "Saving settings from \"emacs -q\" would
overwrite existing customizations"))
+ (setq user-init-file default-init-file)))
+ user-init-file))))
+ (and file
+ (file-chase-links file))))
;; If recentf-mode is non-nil, this is defined.
(declare-function recentf-expand-file-name "recentf" (name))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105112: Allow using `customize-save-variable' under Emacs -Q: Set the variable, and give a warning,
Lars Magne Ingebrigtsen <=