Commit 8af8e70e authored by Paul Eggert's avatar Paul Eggert

Merge from mainline.

parents b12ef411 4b978a67
......@@ -5,5 +9,3 @@ makefile
# arch-tag: 75cd3c50-1875-4814-8360-190f7de38302
2011-03-21 Paul Eggert <>
2011-03-22 Paul Eggert <>
* (GNULIB_MODULES): Add socklen.
* Do not check for sys/socket.h, since socklen does that.
* m4/socklen.m4: New automatically-generated file, from gnulib.
2011-03-21 Paul Eggert <>
fakemail: Remove dependency on ignore-value.
* (GNULIB_MODULES): Add stdio.
* lib/, m4/stdio_h.m4: New files, automatically
imported from gnulib.
* .bzrignore: Add lib/stdio.h.
2011-03-22 Glenn Morris <>
* autogen/copy_autogen: Work from ./ or ../.
Fix time-stamps.
* Doc fix.
2011-03-20 Glenn Morris <>
......@@ -184,7 +184,7 @@ instead of this script.
If all else fails, you can try using the pre-built versions of the
generated files by doing:
cd autogen && ./copy_autogen
This is not recommended - see the comments in \`copy_autogen'.
......@@ -8,12 +8,17 @@
## regenerate configure and will fail if you do not have the required
## tools. You will have to run this script again.
test -d autogen && cd autogen
if test ! -e; then
echo "You must run this script from the autogen/ directory."
echo "Cannot find autogen/ directory."
exit 1
cp configure aclocal.m4 ../
## Order implied by top-level Makefile's rules, for time-stamps.
cp aclocal.m4 ../
cp configure ../
touch ../src/
cp ../src/
cp ../lib/
......@@ -746,6 +746,7 @@ sc.el, x-menu.el, rnews.el, rnewspost.el
* Lisp changes in Emacs 24.1
** byte-compile-disable-print-circle is obsolete.
** deferred-action-list and deferred-action-function are obsolete.
** Removed the stack-trace-on-error variable.
Also the debugger can now "continue" from an error, which means it will jump
to the error handler as if the debugger had not been invoked instead of
2011-03-22 Leo Liu <>
* abbrev.el (write-abbrev-file): Use utf-8 for writing if it can
encode all chars in abbrevs; otherwise use emacs-mule or
utf-8-emacs. (Bug#8308)
2011-03-22 Juanma Barranquero <>
* simple.el (backward-delete-char-untabify):
Avoid warning about using `delete-backward-char'.
* image.el (image-type-file-name-regexps): Make it variable.
`imagemagick-register-types' modifies it, and the user may want
to add new extensions for known image types.
(imagemagick-register-types): Throw error if not using ImageMagick.
2011-03-22 Leo Liu <>
* net/rcirc.el (rcirc-completion-at-point): Return nil if point is
located before rcirc-prompt-end-marker.
(rcirc-complete): Error if point is not after rcirc prompt.
Handle the case when table is nil.
(rcirc-user-authenticated): Define to fix compiler warning.
2011-03-22 Chong Yidong <>
* custom.el (custom--inhibit-theme-enable): Make it affect only
custom-theme-set-variables and custom-theme-set-faces.
(provide-theme): Ignore custom--inhibit-theme-enable.
(load-theme): Enable the theme explicitly if NO-ENABLE is non-nil.
(custom-enabling-themes): Delete variable.
(enable-theme): Accept only loaded themes as arguments. Ignore
the special custom-enabled-themes variable.
(custom-enabled-themes): Forbid themes from setting this.
Eliminate use of custom-enabling-themes.
(custom-push-theme): Quote "changed" custom var entry.
2011-03-21 Leo Liu <>
* ido.el (ido-read-internal): Add ido-selected to history instead
of user input.
2011-03-21 Stefan Monnier <>
* subr.el (deferred-action-list, deferred-action-function):
Mark obsolete.
2011-03-21 Leo Liu <>
* vc/log-view.el: Remove (require 'wid-edit), not needed after the
change on 2011-02-13 (bug#8309).
* minibuffer.el (read-file-name-function): Change default value.
(read-file-name--defaults): Rename from read-file-name-defaults.
(read-file-name-default): Rename from read-file-name.
(read-file-name): Call read-file-name-function.
2011-03-21 Glenn Morris <>
* eshell/esh-opt.el (eshell-eval-using-options, eshell-process-args):
Doc fixes.
2011-03-21 Chong Yidong <>
* cus-theme.el: Add missing provide statement.
(customize-create-theme): Extract theme value correctly.
(custom-theme-visit-theme): Autoload.
(customize-create-theme): Prompt before inserting default faces.
2011-03-20 Jay Belanger <>
* calc/calc-menu.el (calc-units-menu): Add entries for logarithmic
......@@ -225,21 +225,29 @@ specified in `abbrev-file-name' is used."
(or (and file (> (length file) 0))
(setq file abbrev-file-name))
(let ((coding-system-for-write 'emacs-mule))
(with-temp-file file
(insert ";;-*-coding: emacs-mule;-*-\n")
(let ((coding-system-for-write 'utf-8))
(dolist (table
;; We sort the table in order to ease the automatic
;; merging of different versions of the user's abbrevs
;; file. This is useful, for example, for when the
;; user keeps their home directory in a revision
;; control system, and is therefore keeping multiple
;; slightly-differing copies loosely synchronized.
(sort (copy-sequence abbrev-table-name-list)
(lambda (s1 s2)
(string< (symbol-name s1)
(symbol-name s2)))))
(insert-abbrev-table-description table nil)))))
;; We sort the table in order to ease the automatic
;; merging of different versions of the user's abbrevs
;; file. This is useful, for example, for when the
;; user keeps their home directory in a revision
;; control system, and is therefore keeping multiple
;; slightly-differing copies loosely synchronized.
(sort (copy-sequence abbrev-table-name-list)
(lambda (s1 s2)
(string< (symbol-name s1)
(symbol-name s2)))))
(insert-abbrev-table-description table nil))
(when (unencodable-char-position (point-min) (point-max) 'utf-8)
(setq coding-system-for-write
(if (> emacs-major-version 24)
;; For compatibility with Emacs 22 (See Bug#8308)
(goto-char (point-min))
(insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write))
(write-region nil nil file nil 0))))
(defun add-mode-abbrev (arg)
"Define mode-specific abbrev for last word(s) before point.
......@@ -100,6 +100,9 @@ named *Custom Theme*."
(make-local-variable 'custom-theme-insert-face-marker)
(make-local-variable 'custom-theme-insert-variable-marker)
(make-local-variable 'custom-theme--listed-faces)
(when (called-interactively-p 'interactive)
(unless (y-or-n-p "Include basic face customizations in this theme? ")
(setq custom-theme--listed-faces nil)))
(if (eq theme 'user)
(widget-insert "This buffer contains all the Custom settings you have made.
......@@ -188,7 +191,7 @@ remove them from your saved Custom file.\n\n"))
(while vars
(if (eq (car vars) 'custom-enabled-themes)
(progn (pop vars) (pop values))
(custom-theme-add-var-1 (pop vars) (pop values)))))
(custom-theme-add-var-1 (pop vars) (eval (pop values))))))
(setq custom-theme-insert-variable-marker (point-marker))
(widget-insert " ")
(widget-create 'push-button
......@@ -297,8 +300,9 @@ SPEC, if non-nil, should be a face spec to which to set the widget."
;;; Reading and writing
(defun custom-theme-visit-theme (theme)
"Load the custom theme THEME's settings into the current buffer."
"Set up a Custom buffer to edit custom theme THEME."
(intern (completing-read "Find custom theme: "
......@@ -663,4 +667,6 @@ Theme files are named *-theme.el in `"))
(widget-toggle-action widget event)
(setq custom-theme-allow-multiple-selections (widget-value widget)))
(provide 'cus-theme)
;;; cus-theme.el ends here
......@@ -849,10 +849,10 @@ See `custom-known-themes' for a list of known themes."
;; theme is later disabled.
(cond ((and (eq prop 'theme-value)
(boundp symbol))
(let ((sv (get symbol 'standard-value)))
(unless (and sv
(equal (eval (car sv)) (symbol-value symbol)))
(setq old (list (list 'changed (symbol-value symbol)))))))
(let ((sv (get symbol 'standard-value))
(val (symbol-value symbol)))
(unless (and sv (equal (eval (car sv)) val))
(setq old `((changed ,(custom-quote val)))))))
((and (facep symbol)
(not (face-attr-match-p
......@@ -1081,10 +1081,10 @@ name."
:version "24.1")
(defvar custom--inhibit-theme-enable nil
"If non-nil, loading a theme does not enable it.
This internal variable is set by `load-theme' when its NO-ENABLE
argument is non-nil, and it affects `custom-theme-set-variables',
`custom-theme-set-faces', and `provide-theme'." )
"Whether the custom-theme-set-* functions act immediately.
If nil, `custom-theme-set-variables' and `custom-theme-set-faces'
change the current values of the given variable or face. If
non-nil, they just make a record of the theme settings.")
(defun provide-theme (theme)
"Indicate that this file provides THEME.
......@@ -1094,15 +1094,7 @@ property `theme-feature' (which is usually a symbol created by
(unless (custom-theme-name-valid-p theme)
(error "Custom theme cannot be named %S" theme))
(custom-check-theme theme)
(provide (get theme 'theme-feature))
(unless custom--inhibit-theme-enable
;; By default, loading a theme also enables it.
(push theme custom-enabled-themes)
;; `user' must always be the highest-precedence enabled theme.
;; Make that remain true. (This has the effect of making user
;; settings override the ones just loaded, too.)
(let ((custom-enabling-themes t))
(enable-theme 'user))))
(provide (get theme 'theme-feature)))
(defcustom custom-safe-themes '(default)
"List of themes that are considered safe to load.
......@@ -1154,9 +1146,11 @@ Return t if THEME was successfully loaded, nil otherwise."
(expand-file-name "themes/" data-directory)))
(member hash custom-safe-themes)
(custom-theme-load-confirm hash))
(let ((custom--inhibit-theme-enable no-enable))
(let ((custom--inhibit-theme-enable t))
(unless no-enable
(enable-theme theme))
(defun custom-theme-load-confirm (hash)
"Query the user about loading a Custom theme that may not be safe.
......@@ -1235,68 +1229,70 @@ NAME should be a symbol."
;;; Enabling and disabling loaded themes.
(defvar custom-enabling-themes nil)
(defun enable-theme (theme)
"Reenable all variable and face settings defined by THEME.
The newly enabled theme gets the highest precedence (after `user').
If it is already enabled, just give it highest precedence (after `user').
If THEME does not specify any theme settings, this tries to load
the theme from its theme file, by calling `load-theme'."
THEME should be either `user', or a theme loaded via `load-theme'.
After this function completes, THEME will have the highest
precedence (after `user')."
(interactive (list (intern
"Enable custom theme: "
obarray (lambda (sym) (get sym 'theme-settings))))))
obarray (lambda (sym) (get sym 'theme-settings)) t))))
(if (not (custom-theme-p theme))
(load-theme theme)
;; This could use a bit of optimization -- cyd
(let ((settings (get theme 'theme-settings)))
(dolist (s settings)
(let* ((prop (car s))
(symbol (cadr s))
(spec-list (get symbol prop)))
(put symbol prop (cons (cddr s) (assq-delete-all theme spec-list)))
(if (eq prop 'theme-value)
(custom-theme-recalc-variable symbol)
(custom-theme-recalc-face symbol)))))
(unless (eq theme 'user)
(setq custom-enabled-themes
(cons theme (delq theme custom-enabled-themes)))
(unless custom-enabling-themes
(enable-theme 'user)))))
(error "Undefined Custom theme %s" theme))
(let ((settings (get theme 'theme-settings)))
;; Loop through theme settings, recalculating vars/faces.
(dolist (s settings)
(let* ((prop (car s))
(symbol (cadr s))
(spec-list (get symbol prop)))
(put symbol prop (cons (cddr s) (assq-delete-all theme spec-list)))
((eq prop 'theme-face)
(custom-theme-recalc-face symbol))
((eq prop 'theme-value)
;; Don't change `custom-enabled-themes'; that's special.
(unless (eq symbol 'custom-enabled-themes)
(custom-theme-recalc-variable symbol)))))))
(unless (eq theme 'user)
(setq custom-enabled-themes
(cons theme (delq theme custom-enabled-themes)))
;; Give the `user' theme the highest priority.
(enable-theme 'user)))
(defcustom custom-enabled-themes nil
"List of enabled Custom Themes, highest precedence first.
This list does not include the `user' theme, which is set by
Customize and always takes precedence over other Custom Themes.
This does not include the `user' theme, which is set by Customize,
and always takes precedence over other Custom Themes."
This variable cannot be defined inside a Custom theme; there, it
is simply ignored."
:group 'customize
:type '(repeat symbol)
:set-after '(custom-theme-directory custom-theme-load-path
:risky t
:set (lambda (symbol themes)
;; Avoid an infinite loop when custom-enabled-themes is
;; defined in a theme (e.g. `user'). Enabling the theme sets
;; custom-enabled-themes, which enables the theme...
(unless custom-enabling-themes
(let ((custom-enabling-themes t) failures)
(setq themes (delq 'user (delete-dups themes)))
(if (boundp symbol)
(dolist (theme (symbol-value symbol))
(if (not (memq theme themes))
(disable-theme theme))))
(dolist (theme (reverse themes))
(condition-case nil
(enable-theme theme)
(error (progn (push theme failures)
(setq themes (delq theme themes))))))
(enable-theme 'user)
(custom-set-default symbol themes)
(if failures
(message "Failed to enable themes: %s"
(mapconcat 'symbol-name failures " ")))))))
(let (failures)
(setq themes (delq 'user (delete-dups themes)))
;; Disable all themes not in THEMES.
(if (boundp symbol)
(dolist (theme (symbol-value symbol))
(if (not (memq theme themes))
(disable-theme theme))))
;; Call `enable-theme' or `load-theme' on each of THEMES.
(dolist (theme (reverse themes))
(condition-case nil
(if (custom-theme-p theme)
(enable-theme theme)
(load-theme theme))
(error (setq failures (cons theme failures)
themes (delq theme themes)))))
(enable-theme 'user)
(custom-set-default symbol themes)
(if failures
(message "Failed to enable theme: %s"
(mapconcat 'symbol-name failures ", "))))))
(defsubst custom-theme-enabled-p (theme)
"Return non-nil if THEME is enabled."
......@@ -35,13 +35,51 @@ Eshell commands implemented in Lisp."
;;; User Functions:
(defmacro eshell-eval-using-options (name macro-args
options &rest body-forms)
(defmacro eshell-eval-using-options (name macro-args options &rest body-forms)
"Process NAME's MACRO-ARGS using a set of command line OPTIONS.
After doing so, settings will be stored in local symbols as declared
by OPTIONS; FORMS will then be evaluated -- assuming all was OK.
After doing so, stores settings in local symbols as declared by OPTIONS;
then evaluates BODY-FORMS -- assuming all was OK.
The syntax of OPTIONS is:
OPTIONS is a list, beginning with one or more elements of the form:
Each of these elements represents a particular command-line switch.
SHORT is either nil, or a character that can be used as a switch -SHORT.
LONG is either nil, or a string that can be used as a switch --LONG.
At least one of SHORT and LONG must be non-nil.
VALUE is the value associated with the option. It can be either:
t - the option needs a value to be specified after the switch;
nil - the option is given the value t;
anything else - specifies the actual value for the option.
SYMBOL is either nil, or the name of the Lisp symbol that will be bound
to VALUE. A nil SYMBOL calls `eshell-show-usage', and so is appropriate
for a \"--help\" type option.
HELP-STRING is a documentation string for the option.
Any remaining elements of OPTIONS are :KEYWORD arguments. Some take
arguments, some do not. The recognized :KEYWORDS are:
:external STRING
STRING is an external command to run if there are unknown switches.
:usage STRING
STRING is the initial part of the command's documentation string.
It appears before the options are listed.
:post-usage STRING
STRING is an optional trailing part of the command's documentation string.
It appears after the options, but before the final part of the
documentation about the associated external command (if there is one).
If present, then show the usage message if the command is called with no
If present, do not pass MACRO-ARGS through `eshell-flatten-list'
and `eshell-stringify-list'.
For example, OPTIONS might look like:
'((?C nil nil multi-column \"multi-column display\")
(nil \"help\" nil nil \"show this usage display\")
......@@ -52,8 +90,9 @@ The syntax of OPTIONS is:
Sort entries alphabetically across.\")
`eshell-eval-using-options' returns the value of the last form in
BODY-FORMS. If instead an external command is run, the tag
`eshell-external' will be thrown with the new process for its value.
BODY-FORMS. If instead an external command is run (because of
an unknown option), the tag `eshell-external' will be thrown with
the new process for its value.
Lastly, any remaining arguments will be available in a locally
interned variable `args' (created using a `let' form)."
......@@ -200,7 +239,7 @@ switch is unrecognized."
(defun eshell-process-args (name args options)
"Process the given ARGS using OPTIONS.
This assumes that symbols have been intern'd by `eshell-with-options'."
This assumes that symbols have been intern'd by `eshell-eval-using-options'."
(let ((ai 0) arg)
(while (< ai (length args))
(setq arg (nth ai args))
2011-03-21 Julien Danjou <>
* mm-view.el (mm-display-inline-fontify): Make mode optional, and call
normal-mode if not set. Set temp buffer unmodified to avoid kill-buffer
(mm-inline-text): Render normal text with fontification whenever
* gnus-sum.el (gnus-summary-save-parts-1):
* gnus-art.el (gnus-article-browse-html-save-cid-content)
(gnus-article-browse-html-parts, gnus-mime-delete-part)
(gnus-mime-copy-part, gnus-mime-inline-part, gnus-insert-mime-button):
Use `mm-handle-filename'.
* mm-util.el (mm-handle-filename): New function, return the filename of
an handle.
2011-03-18 Julien Danjou <>
* gnus-util.el (gnus-buffer-live-p): Simplify gnus-buffer-live-p.
......@@ -2811,14 +2811,11 @@ Return file name."
((equal (concat "<" cid ">") (mm-handle-id handle))
(setq file
(or (mail-content-type-get
(mm-handle-disposition handle) 'filename)
(setq type (mm-handle-type handle)) 'name)
(make-temp-name "cid")
(car (rassoc (car type) mailcap-mime-extensions))))
(or (mm-handle-filename handle)
(make-temp-name "cid")
(car (rassoc (car (mm-handle-type handle)) mailcap-mime-extensions))))
(mm-save-part-to-file handle file)
(throw 'found file))))))))
......@@ -2835,10 +2832,7 @@ message header will be added to the bodies of the \"text/html\" parts."
((or (equal (car (setq type (mm-handle-type handle))) "text/html")
(and (equal (car type) "message/external-body")
(or header
(setq file (or (mail-content-type-get type 'name)
(mm-handle-disposition handle)
(setq file (mm-handle-filename handle)))
(or (mm-handle-cache handle)
(condition-case code
(progn (mm-extern-cache-contents handle) t)
......@@ -5043,14 +5037,11 @@ Deleting parts may malfunction or destroy the article; continue? "))
(let* ((data (get-text-property (point) 'gnus-data))
(id (get-text-property (point) 'gnus-part))
(handles gnus-article-mime-handles)
(none "(none)")
(let ((desc (mm-handle-description data)))
(when desc
(mail-decode-encoded-word-string desc))))
(or (mail-content-type-get (mm-handle-disposition data) 'filename)
(filename (or (mm-handle-filename (mm-handle-disposition data)) "(none)"))
(type (mm-handle-media-type data)))
(unless data
(error "No MIME part under point"))
......@@ -5168,10 +5159,7 @@ are decompressed."
(unless handle
(setq handle (get-text-property (point) 'gnus-data)))
(when handle
(let ((filename (or (mail-content-type-get (mm-handle-type handle)
(mail-content-type-get (mm-handle-disposition handle)
(let ((filename (mm-handle-filename handle))
contents dont-decode charset coding-system)
(mm-insert-part handle)
......@@ -5261,12 +5249,7 @@ Compressed files like .gz and .bz2 are decompressed."
(mm-insert-part handle)
(setq contents
(or (mm-decompress-buffer
(or (mail-content-type-get (mm-handle-type handle)
(mail-content-type-get (mm-handle-disposition handle)
nil t)
(or (mm-decompress-buffer (mm-handle-filename handle) nil t)
((not arg)
......@@ -5671,8 +5654,7 @@ all parts."
(defun gnus-insert-mime-button (handle gnus-tmp-id &optional displayed)
(let ((gnus-tmp-name
(or (mail-content-type-get (mm-handle-type handle) 'name)
(mail-content-type-get (mm-handle-disposition handle) 'filename)
(or (mm-handle-filename handle)
(mail-content-type-get (mm-handle-type handle) 'url)
(gnus-tmp-type (mm-handle-media-type handle))
......@@ -12142,10 +12142,7 @@ If REVERSE, save parts that do not match TYPE."
(mm-handle-disposition handle) 'filename)
(mm-handle-type handle) 'name)
(mm-handle-filename handle)
(format "%s.%d.%d" gnus-newsgroup-name
(cdr gnus-article-current)
......@@ -1667,6 +1667,13 @@ gzip, bzip2, etc. are allowed."
(when decomp
(kill-buffer (current-buffer)))))))
(defun mm-handle-filename (handle)
"Return filename of HANDLE if any."
(or (mail-content-type-get (mm-handle-type handle)
(mail-content-type-get (mm-handle-disposition handle)
(provide 'mm-util)
;;; mm-util.el ends here
......@@ -455,7 +455,7 @@
(narrow-to-region (point) (point))
(mm-insert-part handle)
(goto-char (point-max)))
(insert (mm-decode-string (mm-get-part handle) charset)))
(mm-display-inline-fontify handle))
(when (and mm-fill-flowed
(equal type "plain")
(equal (cdr (assoc 'format (mm-handle-type handle)))
......@@ -565,15 +565,16 @@
(face-property 'default prop) (current-buffer))))
(delete-region ,(point-min-marker) ,(point-max-marker)))))))))
(defun mm-display-inline-fontify (handle mode)
(defun mm-display-inline-fontify (handle &optional mode)
"Insert HANDLE inline fontifying with MODE.
If MODE is not set, try to find mode automatically."
(let ((charset (mail-content-type-get (mm-handle-type handle) 'charset))
text coding-system)
(unless (eq charset 'gnus-decoded)
(mm-insert-part handle)
(or (mail-content-type-get (mm-handle-disposition handle) 'name)
(mail-content-type-get (mm-handle-disposition handle) 'filename))
(mm-handle-filename handle)
t t)
(unless charset
(setq coding-system (mm-find-buffer-file-coding-system)))
......@@ -601,7 +602,10 @@
(font-lock-support-mode nil)
;; I find font-lock a bit too verbose.
(font-lock-verbose nil))
(funcall mode)
(setq buffer-file-name (mm-handle-filename handle))
(if mode
(funcall mode)
;; The mode function might have already turned on font-lock.
(unless (symbol-value 'font-lock-mode)
......@@ -614,6 +618,9 @@
nil nil nil nil nil 'text-prop))
(setq text (buffer-string))
;; Set buffer unmodified to avoid confirmation when killing the
;; buffer.
(set-buffer-modified-p nil)
(kill-buffer (current-buffer)))
(mm-insert-inline handle text)))
......@@ -1978,7 +1978,9 @@ If INITIAL is non-nil, it specifies the initial input string."
(ido-completing-read t)
(ido-require-match require-match)
(ido-use-mycompletion-depth (1+ (minibuffer-depth)))
(show-paren-mode nil))
(show-paren-mode nil)
;; Postpone history adding till later
(history-add-new-input nil))
;; prompt the user for the file name
(setq ido-exit nil)
(setq ido-final-text
......@@ -2158,6 +2160,7 @@ If INITIAL is non-nil, it specifies the initial input string."
(setq done t))))))
(and history (add-to-history history ido-selected))
(defun ido-edit-input ()
......@@ -60,7 +60,7 @@ IMAGE-TYPE must be a pair (PREDICATE . TYPE). PREDICATE is called
with one argument, a string containing the image data. If PREDICATE returns
a non-nil value, TYPE is the image's type.")
(defconst image-type-file-name-regexps
(defvar image-type-file-name-regexps
'(("\\.png\\'" . png)
("\\.gif\\'" . gif)
("\\.jpe?g\\'" . jpeg)
......@@ -710,17 +710,19 @@ shall be displayed."