Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102799. ------------------------------------------------------------ revno: 102799 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 23:59:56 -0500 message: Record "safe themes" as sha1 hashes, as suggested by Stefan Monnier. * lisp/custom.el (custom-safe-themes): Rename from custom-safe-theme-files. Add :risky tag. (load-theme, custom-theme-load-confirm): Save sha1 hashes to custom-safe-themes, not filenames. Suggested by Stefan Monnier. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-01-08 19:19:55 +0000 +++ etc/NEWS 2011-01-09 04:59:56 +0000 @@ -219,9 +219,10 @@ is to search in `custom-theme-directory', followed by a built-in theme directory named "themes/" in `data-directory'. -*** New option `custom-safe-theme-files' lists known-safe theme files. -If a theme is not in this list, Emacs queries before loading it. -The default value treats all themes included in Emacs as safe. +*** New option `custom-safe-themes' records known-safe theme files. +If a theme is not in this list, Emacs queries before loading it, and +offers to save the theme to `custom-safe-themes' automatically. By +default, all themes included in Emacs are treated as safe. ** The user option `remote-file-name-inhibit-cache' controls whether the remote file-name cache is used for read access. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-09 04:13:47 +0000 +++ lisp/ChangeLog 2011-01-09 04:59:56 +0000 @@ -1,5 +1,12 @@ 2011-01-09 Chong Yidong + * custom.el (custom-safe-themes): Rename from + custom-safe-theme-files. Add :risky tag. + (load-theme, custom-theme-load-confirm): Save sha1 hashes to + custom-safe-themes, not filenames. Suggested by Stefan Monnier. + +2011-01-09 Chong Yidong + * tool-bar.el (tool-bar-setup): Remove Help button. Remove label from Search and add a label to Undo. === modified file 'lisp/custom.el' --- lisp/custom.el 2011-01-08 19:19:55 +0000 +++ lisp/custom.el 2011-01-09 04:59:56 +0000 @@ -1105,14 +1105,16 @@ (let ((custom-enabling-themes t)) (enable-theme 'user)))) -(defcustom custom-safe-theme-files '(default) - "List of theme files that are considered safe to load. -Each list element should be either an absolute file name, or the -symbol `default', which stands for the built-in Emacs theme -directory (a directory named \"themes\" in `data-directory'." +(defcustom custom-safe-themes '(default) + "List of themes that are considered safe to load. +Each list element should be the `sha1' hash of a theme file, or +the symbol `default', which stands for any theme in the built-in +Emacs theme directory (a directory named \"themes\" in +`data-directory')." :type '(repeat - (choice file (const :tag "Built-in theme directory" default))) + (choice string (const :tag "Built-in themes" default))) :group 'customize + :risky t :version "24.1") (defvar safe-functions) ; From unsafep.el @@ -1140,74 +1142,74 @@ (put theme 'theme-documentation nil)) (let ((fn (locate-file (concat (symbol-name theme) "-theme.el") (custom-theme--load-path) - '("" "c")))) + '("" "c"))) + hash) (unless fn (error "Unable to find theme file for `%s'." theme)) - ;; Check file safety. - (when (or (and (memq 'default custom-safe-theme-files) - (equal (file-name-directory fn) - (expand-file-name "themes/" data-directory))) - (member fn custom-safe-theme-files) - ;; If the file is not in the builtin theme directory or - ;; in `custom-safe-theme-files', check it with unsafep. - (with-temp-buffer - (require 'unsafep) - (insert-file-contents fn) - (let ((safe-functions (append '(provide-theme deftheme - custom-theme-set-variables - custom-theme-set-faces) - safe-functions)) - unsafep form) - (while (and (setq form (condition-case nil - (let ((read-circle nil)) - (read (current-buffer))) - (end-of-file nil))) - (null (setq unsafep (unsafep form))))) - (or (null unsafep) - (custom-theme-load-confirm fn))))) - (let ((custom--inhibit-theme-enable no-enable)) - (load fn))))) + (with-temp-buffer + (insert-file-contents fn) + (setq hash (sha1 (current-buffer))) + ;; Check file safety. + (when (or (and (memq 'default custom-safe-themes) + (equal (file-name-directory fn) + (expand-file-name "themes/" data-directory))) + (member hash custom-safe-themes) + ;; If the theme is not in `custom-safe-themes', check + ;; it with unsafep. + (progn + (require 'unsafep) + (let ((safe-functions + (append '(provide-theme deftheme + custom-theme-set-variables + custom-theme-set-faces) + safe-functions)) + unsafep form) + (while (and (setq form (condition-case nil + (let ((read-circle nil)) + (read (current-buffer))) + (end-of-file nil))) + (null (setq unsafep (unsafep form))))) + (or (null unsafep) + (custom-theme-load-confirm hash))))) + (let ((custom--inhibit-theme-enable no-enable)) + (eval-buffer)))))) -(defun custom-theme-load-confirm (filename) +(defun custom-theme-load-confirm (hash) + "Query the user about loading a Custom theme that may not be safe. +The theme should be in the current buffer. If the user agrees, +query also about adding HASH to `custom-safe-themes'." (if noninteractive nil - (let ((existing-buffer (find-buffer-visiting filename)) - (exit-chars '(?y ?n ?\s ?\C-g)) + (let ((exit-chars '(?y ?n ?\s)) prompt char) (save-window-excursion - (if existing-buffer - (pop-to-buffer existing-buffer) - (find-file filename)) - (unwind-protect - (progn - (setq prompt - (format "This theme is not guaranteed to be safe. Really load? %s" - (if (< (line-number-at-pos (point-max)) - (window-body-height)) - "(y or n) " - (push ?\C-v exit-chars) - "Type y or n, or C-v to scroll: "))) - (goto-char (point-min)) - (while (null char) - (setq char (read-char-choice prompt exit-chars t)) - (when (eq char ?\C-v) - (condition-case nil - (scroll-up) - (error (goto-char (point-min)))) - (setq char nil))) - (when (memq char '(?\s ?y)) - (push filename custom-safe-theme-files) - ;; Offer to save to `custom-safe-theme-files'. - (and (or custom-file user-init-file) - (y-or-n-p "Treat %s as safe for future loads? " - (file-name-nondirectory filename)) - (let ((coding-system-for-read nil)) - (customize-save-variable - 'custom-safe-theme-files - custom-safe-theme-files))) - t)) - ;; Unwind form. - (unless existing-buffer (kill-buffer))))))) + (rename-buffer "*Custom Theme*" t) + (emacs-lisp-mode) + (display-buffer (current-buffer)) + (setq prompt + (format "This theme is not guaranteed to be safe. Really load? %s" + (if (< (line-number-at-pos (point-max)) + (window-body-height)) + "(y or n) " + (push ?\C-v exit-chars) + "Type y or n, or C-v to scroll: "))) + (goto-char (point-min)) + (while (null char) + (setq char (read-char-choice prompt exit-chars)) + (when (eq char ?\C-v) + (condition-case nil + (scroll-up) + (error (goto-char (point-min)))) + (setq char nil))) + (when (memq char '(?\s ?y)) + (push hash custom-safe-themes) + ;; Offer to save to `custom-safe-themes'. + (and (or custom-file user-init-file) + (y-or-n-p "Treat this theme as safe for future loads? ") + (let ((coding-system-for-read nil)) + (customize-save-variable 'custom-safe-themes + custom-safe-themes))) + t))))) (defun custom-theme-name-valid-p (name) "Return t if NAME is a valid name for a Custom theme, nil otherwise. ------------------------------------------------------------ revno: 102798 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 23:13:47 -0500 message: Tweaks to tool-bar for default, VC-dir, Compile, and Info. * tool-bar.el (tool-bar-setup): Remove Help button. Remove label from Search and add a label to Undo. * vc/vc-dir.el (vc-dir-tool-bar-map): Rearrange, removing inappropriate buttons and adding :vert-only tags. * progmodes/compile.el (compilation-mode-tool-bar-map): Adjust to removal of Help tool-bar button. Remove Undo button for space. * info.el (info-tool-bar-map): Add :vert-only tags. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 22:57:07 +0000 +++ lisp/ChangeLog 2011-01-09 04:13:47 +0000 @@ -1,3 +1,16 @@ +2011-01-09 Chong Yidong + + * tool-bar.el (tool-bar-setup): Remove Help button. Remove label + from Search and add a label to Undo. + + * vc/vc-dir.el (vc-dir-tool-bar-map): Rearrange, removing + inappropriate buttons and adding :vert-only tags. + + * progmodes/compile.el (compilation-mode-tool-bar-map): Adjust to + removal of Help tool-bar button. Remove Undo button for space. + + * info.el (info-tool-bar-map): Add :vert-only tags. + 2011-01-08 Tassilo Horn * doc-view.el (doc-view-mode-p): Check for png or imagemagick === modified file 'lisp/info.el' --- lisp/info.el 2010-12-20 00:17:26 +0000 +++ lisp/info.el 2011-01-09 04:13:47 +0000 @@ -3777,13 +3777,16 @@ (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map :vert-only t) (define-key-after map [separator-2] menu-bar-separator) - (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map) + (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map + :vert-only t) (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map) (define-key-after map [separator-3] menu-bar-separator) (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map - :label "Index Search") - (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map) - (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map) + :label "Index") + (tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map + :vert-only t) + (tool-bar-local-item-from-menu 'Info-exit "exit" map Info-mode-map + :vert-only t) map)) (defvar Info-menu-last-node nil) === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2011-01-08 13:32:31 +0000 +++ lisp/progmodes/compile.el 2011-01-09 04:13:47 +0000 @@ -1569,9 +1569,11 @@ (defvar compilation-mode-tool-bar-map ;; When bootstrapping, tool-bar-map is not properly initialized yet, ;; so don't do anything. - (when (keymapp (butlast tool-bar-map)) - (let ((map (butlast (copy-keymap tool-bar-map))) - (help (last tool-bar-map))) ;; Keep Help last in tool bar + (when (keymapp tool-bar-map) + (let ((map (copy-keymap tool-bar-map))) + (define-key map [undo] nil) + (define-key map [separator-2] nil) + (define-key-after map [separator-compile] menu-bar-separator) (tool-bar-local-item "left-arrow" 'previous-error-no-select 'previous-error-no-select map :rtl "right-arrow" @@ -1588,7 +1590,7 @@ (tool-bar-local-item "refresh" 'recompile 'recompile map :help "Restart compilation") - (append map help)))) + map))) (put 'compilation-mode 'mode-class 'special) === modified file 'lisp/tool-bar.el' --- lisp/tool-bar.el 2010-12-28 09:39:25 +0000 +++ lisp/tool-bar.el 2011-01-09 04:13:47 +0000 @@ -254,7 +254,7 @@ (tool-bar-add-item-from-menu 'save-buffer "save" nil :label "Save") (define-key-after (default-value 'tool-bar-map) [separator-1] menu-bar-separator) - (tool-bar-add-item-from-menu 'undo "undo" nil :vert-only t) + (tool-bar-add-item-from-menu 'undo "undo" nil) (define-key-after (default-value 'tool-bar-map) [separator-2] menu-bar-separator) (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut]) "cut" nil :vert-only t) @@ -263,25 +263,22 @@ (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste]) "paste" nil :vert-only t) (define-key-after (default-value 'tool-bar-map) [separator-3] menu-bar-separator) - (tool-bar-add-item-from-menu 'nonincremental-search-forward "search" - nil :label "Search") + (tool-bar-add-item-from-menu 'isearch-forward "search" + nil :label "Search" :vert-only t) ;;(tool-bar-add-item-from-menu 'ispell-buffer "spell") ;; There's no icon appropriate for News and we need a command rather ;; than a lambda for Read Mail. ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose") - - ;; tool-bar-add-item-from-menu itself operates on - ;; (default-value 'tool-bar-map), but when we don't use that function, - ;; we must explicitly operate on the default value. - - (let ((tool-bar-map (default-value 'tool-bar-map))) - (tool-bar-add-item "help" (lambda () - (interactive) - (popup-menu menu-bar-help-menu)) - 'help - :help "Pop up the Help menu"))) + ;; Help button on a tool bar is rather non-standard... + ;; (let ((tool-bar-map (default-value 'tool-bar-map))) + ;; (tool-bar-add-item "help" (lambda () + ;; (interactive) + ;; (popup-menu menu-bar-help-menu)) + ;; 'help + ;; :help "Pop up the Help menu")) +) (if (featurep 'move-toolbar) (defcustom tool-bar-position 'top === modified file 'lisp/vc/vc-dir.el' --- lisp/vc/vc-dir.el 2010-12-13 15:27:36 +0000 +++ lisp/vc/vc-dir.el 2011-01-09 04:13:47 +0000 @@ -196,7 +196,7 @@ '(menu-item "Show Incoming Log" vc-log-incoming :help "Show a log of changes that will be received with a pull operation")) (define-key map [log] - '(menu-item "Show history" vc-print-log + '(menu-item "Show History" vc-print-log :help "List the change log of the current file set in a window")) (define-key map [rlog] '(menu-item "Show Top of the Tree History " vc-print-root-log @@ -307,33 +307,36 @@ (defvar vc-dir-tool-bar-map (let ((map (make-sparse-keymap))) - (tool-bar-local-item-from-menu 'vc-dir-find-file "open" - map vc-dir-mode-map) - (tool-bar-local-item "bookmark_add" - 'vc-dir-toggle-mark 'vc-dir-toggle-mark map - :help "Toggle mark on current item" - :label "Toggle Mark") - (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow" - map vc-dir-mode-map - :rtl "right-arrow") - (tool-bar-local-item-from-menu 'vc-dir-next-line "right-arrow" - map vc-dir-mode-map - :rtl "left-arrow") + (tool-bar-local-item-from-menu 'find-file "new" map nil + :label "New File" :vert-only t) + (tool-bar-local-item-from-menu 'menu-find-file-existing "open" map nil + :label "Open" :vert-only t) + (tool-bar-local-item-from-menu 'dired "diropen" map nil + :vert-only t) + (tool-bar-local-item-from-menu 'quit-window "close" map vc-dir-mode-map + :vert-only t) + (tool-bar-local-item-from-menu 'vc-next-action "saveas" map + vc-dir-mode-map :label "Commit") (tool-bar-local-item-from-menu 'vc-print-log "info" - map vc-dir-mode-map) + map vc-dir-mode-map + :label "Log") + (define-key-after map [separator-1] menu-bar-separator) + (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel" + map vc-dir-mode-map + :label "Stop" :vert-only t) (tool-bar-local-item-from-menu 'revert-buffer "refresh" - map vc-dir-mode-map) - (tool-bar-local-item-from-menu 'nonincremental-search-forward - "search" map nil - :label "Search") - (tool-bar-local-item-from-menu 'vc-dir-query-replace-regexp - "search-replace" map vc-dir-mode-map - :label "Replace") - (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel" - map vc-dir-mode-map - :label "Cancel") - (tool-bar-local-item-from-menu 'quit-window "exit" - map vc-dir-mode-map) + map vc-dir-mode-map :vert-only t) + (define-key-after map [separator-2] menu-bar-separator) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [cut]) + "cut" map nil :vert-only t) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [copy]) + "copy" map nil :vert-only t) + (tool-bar-local-item-from-menu (lookup-key menu-bar-edit-menu [paste]) + "paste" map nil :vert-only t) + (define-key-after map [separator-3] menu-bar-separator) + (tool-bar-local-item-from-menu 'isearch-forward + "search" map nil + :label "Search" :vert-only t) map)) (defun vc-dir-node-directory (node) ------------------------------------------------------------ revno: 102797 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 22:29:49 -0500 message: Minor fix to GTK tool-bar button refresh code. * gtkutil.c (update_frame_tool_bar): Don't advance tool-bar index when removing extra buttons. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-01-08 21:17:58 +0000 +++ src/ChangeLog 2011-01-09 03:29:49 +0000 @@ -1,3 +1,8 @@ +2011-01-09 Chong Yidong + + * gtkutil.c (update_frame_tool_bar): Don't advance tool-bar index + when removing extra buttons. + 2011-01-08 Chong Yidong * fns.c (Fyes_or_no_p): Doc fix. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2011-01-01 06:02:36 +0000 +++ src/gtkutil.c 2011-01-09 03:29:49 +0000 @@ -4439,7 +4439,7 @@ /* Remove buttons not longer needed. */ do { - ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j++); + ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), j); if (ti) gtk_container_remove (GTK_CONTAINER (wtoolbar), GTK_WIDGET (ti)); } while (ti != NULL); ------------------------------------------------------------ revno: 102796 committer: Tassilo Horn branch nick: trunk timestamp: Sat 2011-01-08 23:57:07 +0100 message: * doc-view.el (doc-view-mode-p): Check for png or imagemagick image backend support. Either of them is fine. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 21:17:58 +0000 +++ lisp/ChangeLog 2011-01-08 22:57:07 +0000 @@ -1,3 +1,8 @@ +2011-01-08 Tassilo Horn + + * doc-view.el (doc-view-mode-p): Check for png or imagemagick + image backend support. Either of them is fine. + 2011-01-08 Chong Yidong * subr.el (y-or-n-p): Doc fix. === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2011-01-05 21:54:23 +0000 +++ lisp/doc-view.el 2011-01-08 22:57:07 +0000 @@ -621,7 +621,8 @@ Document types are symbols like `dvi', `ps', `pdf', or `odf' (any OpenDocument format)." (and (display-graphic-p) - (image-type-available-p 'png) + (or (image-type-available-p 'imagemagick) + (image-type-available-p 'png)) (cond ((eq type 'dvi) (and (doc-view-mode-p 'pdf) ------------------------------------------------------------ revno: 102795 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 16:22:19 -0500 message: * lisp/files.el (directory-abbrev-alist): Minor doc fix (Bug#7777). * doc/lispref/files.texi: Likewise. diff: === modified file 'doc/lispref/files.texi' --- doc/lispref/files.texi 2010-10-03 21:23:13 +0000 +++ doc/lispref/files.texi 2011-01-08 21:22:19 +0000 @@ -1919,7 +1919,7 @@ abbreviations to use for file directories. Each element has the form @code{(@var{from} . @var{to})}, and says to replace @var{from} with @var{to} when it appears in a directory name. The @var{from} string is -actually a regular expression; it should always start with @samp{\`}. +actually a regular expression; it ought to always start with @samp{\`}. The @var{to} string should be an ordinary absolute directory name. Do not use @samp{~} to stand for a home directory in that string. The function @code{abbreviate-file-name} performs these substitutions. === modified file 'lisp/files.el' --- lisp/files.el 2011-01-08 19:17:23 +0000 +++ lisp/files.el 2011-01-08 21:22:19 +0000 @@ -57,7 +57,7 @@ A list of elements of the form (FROM . TO), each meaning to replace FROM with TO when it appears in a directory name. This replacement is done when setting up the default directory of a newly visited file. -*Every* FROM string should start with \"\\\\`\". +*Every* FROM string ought to start with \"\\\\`\". FROM and TO should be equivalent names, which refer to the same directory. Do not use `~' in the TO strings; ------------------------------------------------------------ revno: 102794 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 16:17:58 -0500 message: Doc fix for y-or-n-p and yes-or-no-p. * subr.el (y-or-n-p): Doc fix. * fns.c (Fyes_or_no_p): Doc fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 19:19:55 +0000 +++ lisp/ChangeLog 2011-01-08 21:17:58 +0000 @@ -1,5 +1,7 @@ 2011-01-08 Chong Yidong + * subr.el (y-or-n-p): Doc fix. + * custom.el (custom-safe-theme-files): New defcustom. (custom-theme-load-confirm): New function. (load-theme): Load theme using `load', confirming with === modified file 'lisp/subr.el' --- lisp/subr.el 2011-01-08 19:17:23 +0000 +++ lisp/subr.el 2011-01-08 21:17:58 +0000 @@ -2043,8 +2043,11 @@ (defun y-or-n-p (prompt &rest args) "Ask user a \"y or n\" question. Return t if answer is \"y\". -The argument PROMPT is the string to display to ask the question. -It should end in a space; `y-or-n-p' adds `(y or n) ' to it. +The string to display to ask the question is obtained by +formatting the string PROMPT with arguments ARGS (see `format'). +The result should end in a space; `y-or-n-p' adds \"(y or n) \" +to it. + No confirmation of the answer is requested; a single character is enough. Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses the bindings in `query-replace-map'; see the documentation of that variable === modified file 'src/ChangeLog' --- src/ChangeLog 2011-01-08 13:32:31 +0000 +++ src/ChangeLog 2011-01-08 21:17:58 +0000 @@ -1,3 +1,7 @@ +2011-01-08 Chong Yidong + + * fns.c (Fyes_or_no_p): Doc fix. + 2011-01-08 Andreas Schwab * fns.c (Fyes_or_no_p): Add usage. === modified file 'src/fns.c' --- src/fns.c 2011-01-08 13:32:31 +0000 +++ src/fns.c 2011-01-08 21:17:58 +0000 @@ -2462,10 +2462,13 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0, doc: /* Ask user a yes-or-no question. Return t if answer is yes. -Takes one argument, which is the string to display to ask the question. -It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it. -The user must confirm the answer with RET, -and can edit it until it has been confirmed. +The string to display to ask the question is obtained by +formatting the string PROMPT with arguments ARGS (see `format'). +The result should end in a space; `y-or-n-p' adds \"(yes or no) \" +to it. + +The user must confirm the answer with RET, and can edit it until it +has been confirmed. Under a windowing system a dialog box will be used if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. ------------------------------------------------------------ revno: 102793 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 14:19:55 -0500 message: Load themes using `load', querying if theme file not known safe. * custom.el (custom-safe-theme-files): New defcustom. (custom-theme-load-confirm): New function. (load-theme): Load theme using `load', confirming with custom-theme-load-confirm if necessary. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-01-08 19:17:23 +0000 +++ etc/NEWS 2011-01-08 19:19:55 +0000 @@ -219,6 +219,10 @@ is to search in `custom-theme-directory', followed by a built-in theme directory named "themes/" in `data-directory'. +*** New option `custom-safe-theme-files' lists known-safe theme files. +If a theme is not in this list, Emacs queries before loading it. +The default value treats all themes included in Emacs as safe. + ** The user option `remote-file-name-inhibit-cache' controls whether the remote file-name cache is used for read access. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 19:17:23 +0000 +++ lisp/ChangeLog 2011-01-08 19:19:55 +0000 @@ -1,5 +1,10 @@ 2011-01-08 Chong Yidong + * custom.el (custom-safe-theme-files): New defcustom. + (custom-theme-load-confirm): New function. + (load-theme): Load theme using `load', confirming with + custom-theme-load-confirm if necessary. + * subr.el (read-char-choice): New function, factored out from dired-query and hack-local-variables-confirm. === modified file 'lisp/custom.el' --- lisp/custom.el 2010-10-19 19:22:40 +0000 +++ lisp/custom.el 2011-01-08 19:19:55 +0000 @@ -1105,15 +1105,26 @@ (let ((custom-enabling-themes t)) (enable-theme 'user)))) +(defcustom custom-safe-theme-files '(default) + "List of theme files that are considered safe to load. +Each list element should be either an absolute file name, or the +symbol `default', which stands for the built-in Emacs theme +directory (a directory named \"themes\" in `data-directory'." + :type '(repeat + (choice file (const :tag "Built-in theme directory" default))) + :group 'customize + :version "24.1") + (defvar safe-functions) ; From unsafep.el (defun load-theme (theme &optional no-enable) "Load a theme's settings from its file. Normally, this also enables the theme; use `disable-theme' to disable it. If optional arg NO-ENABLE is non-nil, don't enable -the theme." - ;; Note we do no check for validity of the theme here. - ;; This allows to pull in themes by a file-name convention +the theme. + +A theme file is named THEME-theme.el, where THEME is the theme name, +in one of the directories specified by `custom-theme-load-path'." (interactive (list (intern (completing-read "Load custom theme: " @@ -1132,35 +1143,71 @@ '("" "c")))) (unless fn (error "Unable to find theme file for `%s'." theme)) - ;; Instead of simply loading the theme file, read it manually. - (with-temp-buffer - (insert-file-contents fn) - (require 'unsafep) - (let ((custom--inhibit-theme-enable no-enable) - (safe-functions (append '(custom-theme-set-variables - custom-theme-set-faces) - safe-functions)) - form scar) - (while (setq form (let ((read-circle nil)) - (condition-case nil - (read (current-buffer)) - (end-of-file nil)))) - (cond - ;; Check `deftheme' expressions. - ((eq (setq scar (car form)) 'deftheme) - (unless (eq (cadr form) theme) - (error "Incorrect theme name in `deftheme'")) - (and (symbolp (nth 1 form)) - (stringp (nth 2 form)) - (eval (list scar (nth 1 form) (nth 2 form))))) - ;; Check `provide-theme' expressions. - ((and (eq scar 'provide-theme) - (equal (cadr form) `(quote ,theme)) - (= (length form) 2)) - (eval form)) - ;; All other expressions need to be safe. - ((not (unsafep form)) - (eval form)))))))) + ;; Check file safety. + (when (or (and (memq 'default custom-safe-theme-files) + (equal (file-name-directory fn) + (expand-file-name "themes/" data-directory))) + (member fn custom-safe-theme-files) + ;; If the file is not in the builtin theme directory or + ;; in `custom-safe-theme-files', check it with unsafep. + (with-temp-buffer + (require 'unsafep) + (insert-file-contents fn) + (let ((safe-functions (append '(provide-theme deftheme + custom-theme-set-variables + custom-theme-set-faces) + safe-functions)) + unsafep form) + (while (and (setq form (condition-case nil + (let ((read-circle nil)) + (read (current-buffer))) + (end-of-file nil))) + (null (setq unsafep (unsafep form))))) + (or (null unsafep) + (custom-theme-load-confirm fn))))) + (let ((custom--inhibit-theme-enable no-enable)) + (load fn))))) + +(defun custom-theme-load-confirm (filename) + (if noninteractive + nil + (let ((existing-buffer (find-buffer-visiting filename)) + (exit-chars '(?y ?n ?\s ?\C-g)) + prompt char) + (save-window-excursion + (if existing-buffer + (pop-to-buffer existing-buffer) + (find-file filename)) + (unwind-protect + (progn + (setq prompt + (format "This theme is not guaranteed to be safe. Really load? %s" + (if (< (line-number-at-pos (point-max)) + (window-body-height)) + "(y or n) " + (push ?\C-v exit-chars) + "Type y or n, or C-v to scroll: "))) + (goto-char (point-min)) + (while (null char) + (setq char (read-char-choice prompt exit-chars t)) + (when (eq char ?\C-v) + (condition-case nil + (scroll-up) + (error (goto-char (point-min)))) + (setq char nil))) + (when (memq char '(?\s ?y)) + (push filename custom-safe-theme-files) + ;; Offer to save to `custom-safe-theme-files'. + (and (or custom-file user-init-file) + (y-or-n-p "Treat %s as safe for future loads? " + (file-name-nondirectory filename)) + (let ((coding-system-for-read nil)) + (customize-save-variable + 'custom-safe-theme-files + custom-safe-theme-files))) + t)) + ;; Unwind form. + (unless existing-buffer (kill-buffer))))))) (defun custom-theme-name-valid-p (name) "Return t if NAME is a valid name for a Custom theme, nil otherwise. ------------------------------------------------------------ revno: 102792 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 14:17:23 -0500 message: New function read-char-choice for reading a restricted set of chars. * lisp/subr.el (read-char-choice): New function, factored out from dired-query and hack-local-variables-confirm. * lisp/dired-aux.el (dired-query): * lisp/files.el (hack-local-variables-confirm): Use it. diff: === modified file 'etc/NEWS' --- etc/NEWS 2011-01-07 17:34:02 +0000 +++ etc/NEWS 2011-01-08 19:17:23 +0000 @@ -662,6 +662,9 @@ * Lisp changes in Emacs 24.1 +** New function `read-char-choice' reads a restricted set of characters, +discarding any inputs not inside the set. + ** `y-or-n-p' and `yes-or-no-p' now accept format string arguments. ** `image-library-alist' is renamed to `dynamic-library-alist'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 13:32:31 +0000 +++ lisp/ChangeLog 2011-01-08 19:17:23 +0000 @@ -1,3 +1,18 @@ +2011-01-08 Chong Yidong + + * subr.el (read-char-choice): New function, factored out from + dired-query and hack-local-variables-confirm. + + * dired-aux.el (dired-query): + * files.el (hack-local-variables-confirm): Use it. + + * dired-aux.el (dired-compress-file): + * files.el (abort-if-file-too-large, find-alternate-file) + (set-visited-file-name, write-file, backup-buffer) + (basic-save-buffer, basic-save-buffer-2, save-some-buffers) + (delete-directory, revert-buffer, recover-file, kill-buffer-ask): + Use new format string args for y-or-n-p and yes-or-no-p. + 2011-01-08 Andreas Schwab * progmodes/compile.el (compilation-error-regexp-alist-alist) === modified file 'lisp/dired-aux.el' --- lisp/dired-aux.el 2010-12-13 15:27:36 +0000 +++ lisp/dired-aux.el 2011-01-08 19:17:23 +0000 @@ -821,8 +821,8 @@ (let ((out-name (concat file ".gz"))) (and (or (not (file-exists-p out-name)) (y-or-n-p - (format "File %s already exists. Really compress? " - out-name))) + "File %s already exists. Really compress? " + out-name)) (not (dired-check-process (concat "Compressing " file) "gzip" "-f" file)) (or (file-exists-p out-name) @@ -889,55 +889,35 @@ (downcase string) count total (dired-plural-s total)) failures))))) -(defvar dired-query-alist - '((?y . y) (?\040 . y) ; `y' or SPC means accept once - (?n . n) (?\177 . n) ; `n' or DEL skips once - (?! . yes) ; `!' accepts rest - (?q . no) (?\e . no) ; `q' or ESC skips rest - ;; None of these keys quit - use C-g for that. - )) - ;;;###autoload -(defun dired-query (qs-var qs-prompt &rest qs-args) - "Query user and return nil or t. -Store answer in symbol VAR (which must initially be bound to nil). -Format PROMPT with ARGS. -Binding variable `help-form' will help the user who types the help key." - (let* ((char (symbol-value qs-var)) - (action (cdr (assoc char dired-query-alist)))) - (cond ((eq 'yes action) - t) ; accept, and don't ask again - ((eq 'no action) - nil) ; skip, and don't ask again - (t;; no lasting effects from last time we asked - ask now - (let ((cursor-in-echo-area t) - (executing-kbd-macro executing-kbd-macro) - (qprompt (concat qs-prompt - (if help-form - (format " [Type yn!q or %s] " - (key-description - (char-to-string help-char))) - " [Type y, n, q or !] "))) - done result elt) - (while (not done) - (apply 'message qprompt qs-args) - (setq char (set qs-var (read-event))) - (if (numberp char) - (cond ((and executing-kbd-macro (= char -1)) - ;; read-event returns -1 if we are in a kbd - ;; macro and there are no more events in the - ;; macro. Attempt to get an event - ;; interactively. - (setq executing-kbd-macro nil)) - ((eq (key-binding (vector char)) 'keyboard-quit) - (keyboard-quit)) - (t - (setq done (setq elt (assoc char - dired-query-alist))))))) - ;; Display the question with the answer. - (message "%s" (concat (apply 'format qprompt qs-args) - (char-to-string char))) - (memq (cdr elt) '(t y yes))))))) +(defun dired-query (sym prompt &rest args) + "Format PROMPT with ARGS, query user, and store the result in SYM. +The return value is either nil or t. + +The user may type y or SPC to accept once; n or DEL to skip once; +! to accept this and subsequent queries; or q or ESC to decline +this and subsequent queries. + +If SYM is already bound to a non-nil value, this function may +return automatically without querying the user. If SYM is !, +return t; if SYM is q or ESC, return nil." + (let* ((char (symbol-value sym)) + (char-choices '(?y ?\s ?n ?\177 ?! ?q ?\e))) + (cond ((eq char ?!) + t) ; accept, and don't ask again + ((memq char '(?q ?\e)) + nil) ; skip, and don't ask again + (t ; no previous answer - ask now + (setq prompt + (concat (apply 'format prompt args) + (if help-form + (format " [Type yn!q or %s] " + (key-description + (char-to-string help-char))) + " [Type y, n, q or !] "))) + (set sym (setq char (read-char-choice prompt char-choices))) + (if (memq char '(?y ?\s ?!)) t))))) + ;;;###autoload (defun dired-do-compress (&optional arg) === modified file 'lisp/dired.el' --- lisp/dired.el 2010-12-14 04:35:33 +0000 +++ lisp/dired.el 2011-01-08 19:17:23 +0000 @@ -3562,7 +3562,7 @@ ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2e8658304f56098052e312d01c8763a2") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "db61da0d98435f468e41e92c12f99d3b") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ @@ -3723,12 +3723,18 @@ \(fn FILE)" nil nil) (autoload 'dired-query "dired-aux" "\ -Query user and return nil or t. -Store answer in symbol VAR (which must initially be bound to nil). -Format PROMPT with ARGS. -Binding variable `help-form' will help the user who types the help key. - -\(fn QS-VAR QS-PROMPT &rest QS-ARGS)" nil nil) +Format PROMPT with ARGS, query user, and store the result in SYM. +The return value is either nil or t. + +The user may type y or SPC to accept once; n or DEL to skip once; +! to accept this and subsequent queries; or q or ESC to decline +this and subsequent queries. + +If SYM is already bound to a non-nil value, this function may +return automatically without querying the user. If SYM is !, +return t; if SYM is q or ESC, return nil. + +\(fn SYM PROMPT &rest ARGS)" nil nil) (autoload 'dired-do-compress "dired-aux" "\ Compress or uncompress marked (or next ARG) files. === modified file 'lisp/files.el' --- lisp/files.el 2011-01-02 20:28:40 +0000 +++ lisp/files.el 2011-01-08 19:17:23 +0000 @@ -1555,8 +1555,8 @@ (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions) (error "Aborted")) (when (and (buffer-modified-p) buffer-file-name) - (if (yes-or-no-p (format "Buffer %s is modified; save it first? " - (buffer-name))) + (if (yes-or-no-p "Buffer %s is modified; save it first? " + (buffer-name)) (save-buffer) (unless (yes-or-no-p "Kill and replace the buffer without saving it? ") (error "Aborted")))) @@ -1758,12 +1758,11 @@ "If file SIZE larger than `large-file-warning-threshold', allow user to abort. OP-TYPE specifies the file operation being performed (for message to user)." (when (and large-file-warning-threshold size - (> size large-file-warning-threshold) - (not (y-or-n-p - (format "File %s is large (%dMB), really %s? " - (file-name-nondirectory filename) - (/ size 1048576) op-type)))) - (error "Aborted"))) + (> size large-file-warning-threshold) + (not (y-or-n-p "File %s is large (%dMB), really %s? " + (file-name-nondirectory filename) + (/ size 1048576) op-type))) + (error "Aborted"))) (defun find-file-noselect (filename &optional nowarn rawfile wildcards) "Read file FILENAME into a buffer and return the buffer. @@ -2906,91 +2905,80 @@ directory-local variables, or nil otherwise." (if noninteractive nil - (let ((name (or dir-name - (if buffer-file-name - (file-name-nondirectory buffer-file-name) - (concat "buffer " (buffer-name))))) - (offer-save (and (eq enable-local-variables t) unsafe-vars)) - prompt char) - (save-window-excursion - (let ((buf (get-buffer-create "*Local Variables*"))) - (pop-to-buffer buf) - (set (make-local-variable 'cursor-type) nil) - (erase-buffer) - (if unsafe-vars - (insert "The local variables list in " name - "\ncontains values that may not be safe (*)" - (if risky-vars - ", and variables that are risky (**)." - ".")) - (if risky-vars - (insert "The local variables list in " name - "\ncontains variables that are risky (**).") - (insert "A local variables list is specified in " name "."))) - (insert "\n\nDo you want to apply it? You can type + (save-window-excursion + (let* ((name (or dir-name + (if buffer-file-name + (file-name-nondirectory buffer-file-name) + (concat "buffer " (buffer-name))))) + (offer-save (and (eq enable-local-variables t) + unsafe-vars)) + (exit-chars + (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) + (buf (pop-to-buffer "*Local Variables*")) + prompt char) + (set (make-local-variable 'cursor-type) nil) + (erase-buffer) + (cond + (unsafe-vars + (insert "The local variables list in " name + "\ncontains values that may not be safe (*)" + (if risky-vars + ", and variables that are risky (**)." + "."))) + (risky-vars + (insert "The local variables list in " name + "\ncontains variables that are risky (**).")) + (t + (insert "A local variables list is specified in " name "."))) + (insert "\n\nDo you want to apply it? You can type y -- to apply the local variables list. n -- to ignore the local variables list.") - (if offer-save - (insert " + (if offer-save + (insert " ! -- to apply the local variables list, and permanently mark these values (*) as safe (in the future, they will be set automatically.)\n\n") - (insert "\n\n")) - (dolist (elt all-vars) - (cond ((member elt unsafe-vars) - (insert " * ")) - ((member elt risky-vars) - (insert " ** ")) - (t - (insert " "))) - (princ (car elt) buf) - (insert " : ") - ;; Make strings with embedded whitespace easier to read. - (let ((print-escape-newlines t)) - (prin1 (cdr elt) buf)) - (insert "\n")) - (setq prompt - (format "Please type %s%s: " - (if offer-save "y, n, or !" "y or n") - (if (< (line-number-at-pos) (window-body-height)) - "" - ", or C-v to scroll"))) - (goto-char (point-min)) - (let ((cursor-in-echo-area t) - (executing-kbd-macro executing-kbd-macro) - (exit-chars - (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) - done) - (while (not done) - (message "%s" prompt) - (setq char (read-event)) - (if (numberp char) - (cond ((eq char ?\C-v) - (condition-case nil - (scroll-up) - (error (goto-char (point-min))))) - ;; read-event returns -1 if we are in a kbd - ;; macro and there are no more events in the - ;; macro. In that case, attempt to get an - ;; event interactively. - ((and executing-kbd-macro (= char -1)) - (setq executing-kbd-macro nil)) - (t (setq done (memq (downcase char) exit-chars))))))) - (setq char (downcase char)) - (when (and offer-save (= char ?!) unsafe-vars) - (dolist (elt unsafe-vars) - (add-to-list 'safe-local-variable-values elt)) - ;; When this is called from desktop-restore-file-buffer, - ;; coding-system-for-read may be non-nil. Reset it before - ;; writing to .emacs. - (if (or custom-file user-init-file) - (let ((coding-system-for-read nil)) - (customize-save-variable - 'safe-local-variable-values - safe-local-variable-values)))) - (kill-buffer buf) - (or (= char ?!) - (= char ?\s) - (= char ?y))))))) + (insert "\n\n")) + (dolist (elt all-vars) + (cond ((member elt unsafe-vars) + (insert " * ")) + ((member elt risky-vars) + (insert " ** ")) + (t + (insert " "))) + (princ (car elt) buf) + (insert " : ") + ;; Make strings with embedded whitespace easier to read. + (let ((print-escape-newlines t)) + (prin1 (cdr elt) buf)) + (insert "\n")) + (setq prompt + (format "Please type %s%s: " + (if offer-save "y, n, or !" "y or n") + (if (< (line-number-at-pos) (window-body-height)) + "" + (push ?\C-v exit-chars) + ", or C-v to scroll"))) + (goto-char (point-min)) + (while (null char) + (setq char (read-char-choice prompt exit-chars t)) + (when (eq char ?\C-v) + (condition-case nil + (scroll-up) + (error (goto-char (point-min)))) + (setq char nil))) + (kill-buffer buf) + (when (and offer-save (= char ?!) unsafe-vars) + (dolist (elt unsafe-vars) + (add-to-list 'safe-local-variable-values elt)) + ;; When this is called from desktop-restore-file-buffer, + ;; coding-system-for-read may be non-nil. Reset it before + ;; writing to .emacs. + (if (or custom-file user-init-file) + (let ((coding-system-for-read nil)) + (customize-save-variable + 'safe-local-variable-values + safe-local-variable-values)))) + (memq char '(?! ?\s ?y)))))) (defun hack-local-variables-prop-line (&optional mode-only) "Return local variables specified in the -*- line. @@ -3593,8 +3581,8 @@ (let ((buffer (and filename (find-buffer-visiting filename)))) (and buffer (not (eq buffer (current-buffer))) (not no-query) - (not (y-or-n-p (format "A buffer is visiting %s; proceed? " - filename))) + (not (y-or-n-p "A buffer is visiting %s; proceed? " + filename)) (error "Aborted"))) (or (equal filename buffer-file-name) (progn @@ -3705,7 +3693,7 @@ (or buffer-file-name (buffer-name)))))) (and confirm (file-exists-p filename) - (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) + (or (y-or-n-p "File `%s' exists; overwrite? " filename) (error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) @@ -3759,8 +3747,8 @@ (and targets (or (eq delete-old-versions t) (eq delete-old-versions nil)) (or delete-old-versions - (y-or-n-p (format "Delete excess backup versions of %s? " - real-file-name))))) + (y-or-n-p "Delete excess backup versions of %s? " + real-file-name)))) (modes (file-modes buffer-file-name)) (context (file-selinux-context buffer-file-name))) ;; Actually write the back up file. @@ -4334,8 +4322,8 @@ ;; Signal an error if the user specified the name of an ;; existing directory. (error "%s is a directory" filename) - (unless (y-or-n-p (format "File `%s' exists; overwrite? " - filename)) + (unless (y-or-n-p "File `%s' exists; overwrite? " + filename) (error "Canceled"))) ;; Signal an error if the specified name refers to a ;; non-existing directory. @@ -4348,8 +4336,8 @@ (or (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p - (format "%s has changed since visited or saved. Save anyway? " - (file-name-nondirectory buffer-file-name))) + "%s has changed since visited or saved. Save anyway? " + (file-name-nondirectory buffer-file-name)) (error "Save not confirmed")) (save-restriction (widen) @@ -4363,8 +4351,8 @@ (eq require-final-newline 'visit-save) (and require-final-newline (y-or-n-p - (format "Buffer %s does not end in newline. Add one? " - (buffer-name))))) + "Buffer %s does not end in newline. Add one? " + (buffer-name)))) (save-excursion (goto-char (point-max)) (insert ?\n)))) @@ -4426,9 +4414,9 @@ (if (not (file-exists-p buffer-file-name)) (error "Directory %s write-protected" dir) (if (yes-or-no-p - (format "File %s is write-protected; try to save anyway? " - (file-name-nondirectory - buffer-file-name))) + "File %s is write-protected; try to save anyway? " + (file-name-nondirectory + buffer-file-name)) (setq tempsetmodes t) (error "Attempt to save to a file which you aren't allowed to write")))))) (or buffer-backed-up @@ -4619,8 +4607,7 @@ (progn (if (or arg (eq save-abbrevs 'silently) - (y-or-n-p (format "Save abbrevs in %s? " - abbrev-file-name))) + (y-or-n-p "Save abbrevs in %s? " abbrev-file-name)) (write-abbrev-file nil)) ;; Don't keep bothering user if he says no. (setq abbrevs-changed nil) @@ -4795,8 +4782,8 @@ (list dir (if (directory-files dir nil directory-files-no-dot-files-regexp) (y-or-n-p - (format "Directory `%s' is not empty, really %s? " - dir (if trashing "trash" "delete"))) + "Directory `%s' is not empty, really %s? " + dir (if trashing "trash" "delete")) nil) (null current-prefix-arg)))) ;; If default-directory is a remote directory, make sure we find its @@ -4995,8 +4982,8 @@ (dolist (regexp revert-without-query) (when (string-match regexp file-name) (throw 'found t))))) - (yes-or-no-p (format "Revert buffer from file %s? " - file-name))) + (yes-or-no-p "Revert buffer from file %s? " + file-name)) (run-hooks 'before-revert-hook) ;; If file was backed up but has changed since, ;; we should make another backup. @@ -5116,7 +5103,7 @@ ;; to emulate what `ls' did in that case. (insert-directory-safely file switches) (insert-directory-safely file-name switches)))) - (yes-or-no-p (format "Recover auto save file %s? " file-name))) + (yes-or-no-p "Recover auto save file %s? " file-name)) (switch-to-buffer (find-file-noselect file t)) (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system. @@ -5237,9 +5224,9 @@ (defun kill-buffer-ask (buffer) "Kill BUFFER if confirmed." (when (yes-or-no-p - (format "Buffer %s %s. Kill? " (buffer-name buffer) - (if (buffer-modified-p buffer) - "HAS BEEN EDITED" "is unmodified"))) + "Buffer %s %s. Kill? " (buffer-name buffer) + (if (buffer-modified-p buffer) + "HAS BEEN EDITED" "is unmodified")) (kill-buffer buffer))) (defun kill-some-buffers (&optional list) === modified file 'lisp/subr.el' --- lisp/subr.el 2011-01-07 17:34:02 +0000 +++ lisp/subr.el 2011-01-08 19:17:23 +0000 @@ -1970,6 +1970,35 @@ t))) n)) +(defun read-char-choice (prompt chars &optional inhibit-keyboard-quit) + "Read and return one of CHARS, prompting for PROMPT. +Any input that is not one of CHARS is ignored. + +If optional argument INHIBIT-KEYBOARD-QUIT is non-nil, ignore +keyboard-quit events while waiting for a valid input." + (unless (consp chars) + (error "Called `read-char-choice' without valid char choices")) + (let ((cursor-in-echo-area t) + (executing-kbd-macro executing-kbd-macro) + char done) + (while (not done) + (unless (get-text-property 0 'face prompt) + (setq prompt (propertize prompt 'face 'minibuffer-prompt))) + (setq char (let ((inhibit-quit inhibit-keyboard-quit)) + (read-event prompt))) + (cond + ((not (numberp char))) + ((memq char chars) + (setq done t)) + ((and executing-kbd-macro (= char -1)) + ;; read-event returns -1 if we are in a kbd macro and + ;; there are no more events in the macro. Attempt to + ;; get an event interactively. + (setq executing-kbd-macro nil)))) + ;; Display the question with the answer. + (message "%s%s" prompt (char-to-string char)) + char)) + (defun sit-for (seconds &optional nodisp obsolete) "Perform redisplay, then wait for SECONDS seconds or until input is available. SECONDS may be a floating-point value. ------------------------------------------------------------ revno: 102791 committer: Paul Eggert branch nick: trunk timestamp: Sat 2011-01-08 11:03:31 -0800 message: * Makefile.in (EXECUTABLES): Remove; macro unused since 1993. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-01-08 02:53:50 +0000 +++ lib-src/ChangeLog 2011-01-08 19:03:31 +0000 @@ -1,3 +1,7 @@ +2011-01-08 Paul Eggert + + * Makefile.in (EXECUTABLES): Remove; macro unused since 1993. + 2011-01-08 Glenn Morris * Makefile.in (EMACSOPT): Add --no-site-lisp. === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2011-01-08 02:53:50 +0000 +++ lib-src/Makefile.in 2011-01-08 19:03:31 +0000 @@ -128,8 +128,6 @@ SCRIPTS= rcs2log vcdiff STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff -EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} - # Specify additional -D flags for movemail. Options: # -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking). # See the comments about locking in movemail.c. Normally the values ------------------------------------------------------------ revno: 102790 committer: Chong Yidong branch nick: trunk timestamp: Sat 2011-01-08 12:57:55 -0500 message: Change dev-tsdh-dark/dev-tsdh-light theme names to tsdh-dark/tsdh-light, to fit file names. diff: === modified file 'etc/themes/tsdh-dark-theme.el' --- etc/themes/tsdh-dark-theme.el 2011-01-07 10:39:54 +0000 +++ etc/themes/tsdh-dark-theme.el 2011-01-08 17:57:55 +0000 @@ -1,4 +1,4 @@ -;;; dev-tsdh-dark-theme.el --- Tassilo's dark custom theme +;;; tsdh-dark-theme.el --- Tassilo's dark custom theme ;; Copyright (C) 2011 Free Software Foundation, Inc. @@ -19,11 +19,11 @@ ;;; Code: -(deftheme dev-tsdh-dark +(deftheme tsdh-dark "Theme with dark background used and created by Tassilo Horn.") (custom-theme-set-faces - 'dev-tsdh-dark + 'tsdh-dark '(default ((t (:background "gray20" :foreground "white smoke")))) '(diff-added ((t (:inherit diff-changed :background "light green")))) '(diff-changed ((t (:background "light steel blue")))) @@ -55,5 +55,4 @@ '(show-paren-mismatch ((t (:background "deep pink")))) '(window-number-face ((t (:foreground "red" :weight bold))))) -(provide-theme 'dev-tsdh-dark) - +(provide-theme 'tsdh-dark) === modified file 'etc/themes/tsdh-light-theme.el' --- etc/themes/tsdh-light-theme.el 2011-01-07 10:39:54 +0000 +++ etc/themes/tsdh-light-theme.el 2011-01-08 17:57:55 +0000 @@ -1,4 +1,4 @@ -;;; dev-tsdh-light-theme.el --- Tassilo's light custom theme +;;; tsdh-light-theme.el --- Tassilo's light custom theme ;; Copyright (C) 2011 Free Software Foundation, Inc. @@ -19,11 +19,11 @@ ;;; Code: -(deftheme dev-tsdh-light +(deftheme tsdh-light "Black on white theme used and created by Tassilo Horn.") (custom-theme-set-faces - 'dev-tsdh-light + 'tsdh-light '(default ((t (:background "white" :foreground "black")))) '(diff-added ((t (:inherit diff-changed :background "light green")))) '(diff-changed ((t (:background "light steel blue")))) @@ -54,5 +54,4 @@ '(show-paren-mismatch ((t (:background "deep pink")))) '(window-number-face ((t (:foreground "red" :weight bold))))) -(provide-theme 'dev-tsdh-light) - +(provide-theme 'tsdh-light) ------------------------------------------------------------ revno: 102789 committer: Andreas Schwab branch nick: emacs timestamp: Sat 2011-01-08 14:32:31 +0100 message: * src/fns.c (Fyes_or_no_p): Add usage. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-01-08 02:41:14 +0000 +++ src/ChangeLog 2011-01-08 13:32:31 +0000 @@ -1,3 +1,7 @@ +2011-01-08 Andreas Schwab + + * fns.c (Fyes_or_no_p): Add usage. + 2011-01-08 Glenn Morris * makefile.w32-in ($(EMACS)): === modified file 'src/fns.c' --- src/fns.c 2011-01-07 17:34:02 +0000 +++ src/fns.c 2011-01-08 13:32:31 +0000 @@ -1,7 +1,7 @@ /* Random utility Lisp functions. Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2468,7 +2468,8 @@ and can edit it until it has been confirmed. Under a windowing system a dialog box will be used if `last-nonmenu-event' -is nil, and `use-dialog-box' is non-nil. */) +is nil, and `use-dialog-box' is non-nil. +usage: (yes-or-no-p PROMPT &rest ARGS) */) (int nargs, Lisp_Object *args) { register Lisp_Object ans; ------------------------------------------------------------ revno: 102788 committer: Andreas Schwab branch nick: emacs timestamp: Sat 2011-01-08 14:32:31 +0100 message: * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist) [gnu]: Remove unused group. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 13:31:26 +0000 +++ lisp/ChangeLog 2011-01-08 13:32:31 +0000 @@ -3,6 +3,7 @@ * progmodes/compile.el (compilation-error-regexp-alist-alist) [gcc-include]: Tighten file name match, add match for column number. (Bug#7806) + [gnu]: Remove unused group. 2011-01-08 Glenn Morris === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2011-01-08 13:31:26 +0000 +++ lisp/progmodes/compile.el 2011-01-08 13:32:31 +0000 @@ -270,12 +270,12 @@ ;; The "in \\|from " exception was added to handle messages from Ruby. "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\ \\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\ -\\([0-9]+\\)\\(?:\\([.:]\\)\\([0-9]+\\)\\)?\ +\\([0-9]+\\)\\(?:[.:]\\([0-9]+\\)\\)?\ \\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\ \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\ \[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)" - 1 (2 . 5) (4 . 6) (7 . 8)) + 1 (2 . 4) (3 . 5) (6 . 7)) (lcc "^\\(?:E\\|\\(W\\)\\), \\([^(\n]+\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" ------------------------------------------------------------ revno: 102787 committer: Andreas Schwab branch nick: emacs timestamp: Sat 2011-01-08 14:31:26 +0100 message: Fixes: debbugs:7806 * etc/compilation.txt: Add column to gcc-include sample. * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist) [gcc-include]: Tighten file name match, add match for column number. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2011-01-08 02:49:27 +0000 +++ etc/ChangeLog 2011-01-08 13:31:26 +0000 @@ -1,3 +1,7 @@ +2011-01-08 Andreas Schwab + + * compilation.txt: Add column to gcc-include sample. + 2011-01-08 Glenn Morris * PROBLEMS: -batch implies -q. @@ -5158,7 +5162,7 @@ ;; End: Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GNU Emacs. === modified file 'etc/compilation.txt' --- etc/compilation.txt 2010-08-15 00:04:53 +0000 +++ etc/compilation.txt 2011-01-08 13:31:26 +0000 @@ -233,7 +233,7 @@ The last file, i.e. the one you are compiling, is the interesting one. In file included from /usr/include/c++/3.3/backward/warn.h:4, - from /usr/include/c++/3.3/backward/iostream.h:31, + from /usr/include/c++/3.3/backward/iostream.h:31:0, from test_clt.cc:1: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 02:53:50 +0000 +++ lisp/ChangeLog 2011-01-08 13:31:26 +0000 @@ -1,3 +1,9 @@ +2011-01-08 Andreas Schwab + + * progmodes/compile.el (compilation-error-regexp-alist-alist) + [gcc-include]: Tighten file name match, add match for column + number. (Bug#7806) + 2011-01-08 Glenn Morris * makefile.w32-in (EMACSOPT): Add --no-site-lisp. === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2010-12-10 20:00:25 +0000 +++ lisp/progmodes/compile.el 2011-01-08 13:31:26 +0000 @@ -239,7 +239,9 @@ (gcc-include "^\\(?:In file included \\| \\|\t\\)from \ -\\(.+\\):\\([0-9]+\\)\\(?:\\(:\\)\\|\\(,\\|$\\)\\)?" 1 2 nil (3 . 4)) +\\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\):\ +\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?\\(?:\\(:\\)\\|\\(,\\|$\\)\\)?" + 1 2 3 (4 . 5)) (gnu ;; The first line matches the program name for ------------------------------------------------------------ revno: 102786 committer: Glenn Morris branch nick: trunk timestamp: Fri 2011-01-07 18:53:50 -0800 message: Add --no-site-lisp to more Makefiles. * leim/makefile.w32-in (RUN_EMACS): * leim/Makefile.in (RUN-EMACS): Add --no-site-lisp. * lib-src/Makefile.in (EMACSOPT): Add --no-site-lisp. * lisp/makefile.w32-in (EMACSOPT): Add --no-site-lisp. diff: === modified file 'leim/ChangeLog' --- leim/ChangeLog 2011-01-08 02:41:14 +0000 +++ leim/ChangeLog 2011-01-08 02:53:50 +0000 @@ -1,6 +1,9 @@ 2011-01-08 Glenn Morris * makefile.w32-in (RUN_EMACS): + * Makefile.in (RUN-EMACS): Add --no-site-lisp. + + * makefile.w32-in (RUN_EMACS): * Makefile.in (RUN-EMACS): -batch implies --no-init-file. 2010-08-28 Kenichi Handa === modified file 'leim/Makefile.in' --- leim/Makefile.in 2011-01-08 02:41:14 +0000 +++ leim/Makefile.in 2011-01-08 02:53:50 +0000 @@ -48,7 +48,7 @@ # How to run Emacs. RUN-EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \ - ${BUILT-EMACS} -batch --no-site-file + ${BUILT-EMACS} -batch --no-site-file --no-site-lisp # Subdirectories to be made if ${srcdir} is different from the current # directory. === modified file 'leim/makefile.w32-in' --- leim/makefile.w32-in 2011-01-08 02:41:14 +0000 +++ leim/makefile.w32-in 2011-01-08 02:53:50 +0000 @@ -37,7 +37,7 @@ buildlisppath=$(CURDIR)/$(dot)$(dot)/lisp # How to run Emacs. -RUN_EMACS = "$(BUILT_EMACS)" -batch --no-site-file +RUN_EMACS = "$(BUILT_EMACS)" -batch --no-site-file --no-site-lisp # Set EMACSLOADPATH correctly (already defined in environment). EMACSLOADPATH=$(buildlisppath) === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-01-08 02:34:26 +0000 +++ lib-src/ChangeLog 2011-01-08 02:53:50 +0000 @@ -1,5 +1,7 @@ 2011-01-08 Glenn Morris + * Makefile.in (EMACSOPT): Add --no-site-lisp. + * Makefile.in (EMACSOPT): Remove --multibyte, it does nothing any more. 2011-01-02 Glenn Morris === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2011-01-08 02:34:26 +0000 +++ lib-src/Makefile.in 2011-01-08 02:53:50 +0000 @@ -25,7 +25,7 @@ # Following ../lisp/Makefile.in. EMACS = ../src/emacs -EMACSOPT = -batch --no-site-file +EMACSOPT = -batch --no-site-file --no-site-lisp # ==================== Things `configure' will edit ==================== === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-01-08 02:41:14 +0000 +++ lisp/ChangeLog 2011-01-08 02:53:50 +0000 @@ -1,5 +1,7 @@ 2011-01-08 Glenn Morris + * makefile.w32-in (EMACSOPT): Add --no-site-lisp. + * makefile.w32-in (EMACSOPT): -batch implies --no-init-file. 2011-01-07 Sam Steingold === modified file 'lisp/makefile.w32-in' --- lisp/makefile.w32-in 2011-01-08 02:41:14 +0000 +++ lisp/makefile.w32-in 2011-01-08 02:53:50 +0000 @@ -34,7 +34,7 @@ # Command line flags for Emacs. -EMACSOPT = -batch --no-site-file +EMACSOPT = -batch --no-site-file --no-site-lisp # Extra flags to pass to the byte compiler BYTE_COMPILE_EXTRA_FLAGS =