diff options
author | Daniel Colascione <dancol@dancol.org> | 2014-04-07 13:54:16 -0700 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2014-04-07 13:54:16 -0700 |
commit | 7e31acf6b81fdce7258077645bc239767c484841 (patch) | |
tree | 1f0d7b063a19b54982550797df063e0a9f87eaed | |
parent | 608a4502b9fa8f5681368657fba5d5fd0fa46817 (diff) | |
parent | e3b838807bf9fbbbec9826de6c1e4efdf72acb78 (diff) | |
download | emacs-7e31acf6b81fdce7258077645bc239767c484841.tar.gz |
Merge from emacs-24; up to 2014-04-01T20:18:12Z!eggert@cs.ucla.edu
37 files changed, 807 insertions, 223 deletions
diff --git a/ChangeLog b/ChangeLog index a9321a84dd8..7d3f17f8207 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-04-03 Ken Brown <kbrown@cornell.edu> + + * configure.ac (EMACS_MANIFEST, UPDATE_MANIFEST): Leave these + variables empty on Cygwin. (Bug#17176) + 2014-04-03 Glenn Morris <rgm@gnu.org> * make-dist: Further update AC_INIT regexp. diff --git a/configure.ac b/configure.ac index 9ad24630784..be2221d62fd 100644 --- a/configure.ac +++ b/configure.ac @@ -1835,11 +1835,6 @@ if test "${HAVE_W32}" = "yes"; then W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o" W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o" EMACSRES="emacs.res" - case "$canonical" in - x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;; - *) EMACS_MANIFEST="emacs-x86.manifest" ;; - esac - UPDATE_MANIFEST=update-game-score.exe.manifest if test "${opsys}" = "cygwin"; then W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32" W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool" @@ -1847,6 +1842,11 @@ if test "${HAVE_W32}" = "yes"; then # the rc file), not a linker script. W32_RES_LINK="-Wl,emacs.res" else + case "$canonical" in + x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;; + *) EMACS_MANIFEST="emacs-x86.manifest" ;; + esac + UPDATE_MANIFEST=update-game-score.exe.manifest W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o" W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32" W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10" diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 507d9cb427a..f8cb233bb19 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,15 @@ +2014-04-05 Glenn Morris <rgm@gnu.org> + + * trouble.texi (Checklist): Dribble files may contain passwords. + +2014-04-04 Glenn Morris <rgm@gnu.org> + + * files.texi (Backup Names): + * arevert-xtra.texi (Supporting additional buffers): + Update for default values of some -function vars no longer being nil. + (Supporting additional buffers): + Update for buffer-stale-function also applying to file-buffers. + 2014-03-28 Glenn Morris <rgm@gnu.org> * custom.texi (Terminal Init): Mention term-file-aliases. diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi index a13f59b69bd..dcb73bc96de 100644 --- a/doc/emacs/arevert-xtra.texi +++ b/doc/emacs/arevert-xtra.texi @@ -103,15 +103,15 @@ arguments to list only some of the files. @file{*Find*} and This section is intended for Elisp programmers who would like to add support for auto-reverting new types of buffers. -To support auto-reverting the buffer must first of all have a +To support auto-reverting the buffer must first of all have a suitable @code{revert-buffer-function}. @xref{Definition of revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}. -In addition, it @emph{must} have a @code{buffer-stale-function}. +In addition, it must have a suitable @code{buffer-stale-function}. @c FIXME only defvar in all of doc/emacs! @defvar buffer-stale-function -The value of this variable is a function to check whether a non-file +The value of this variable is a function to check whether a buffer needs reverting. This should be a function with one optional argument @var{noconfirm}. The function should return non-@code{nil} if the buffer should be reverted. The buffer is current when this @@ -132,7 +132,7 @@ If you just want to automatically auto-revert every @code{auto-revert-interval} seconds (like the Buffer Menu), use: @example -(set (make-local-variable 'buffer-stale-function) +(setq-local buffer-stale-function #'(lambda (&optional noconfirm) 'fast)) @end example @@ -149,7 +149,7 @@ also be useful if the function is consulted for purposes other than auto-reverting. @end defvar -Once the buffer has a @code{revert-buffer-function} and a +Once the buffer has a suitable @code{revert-buffer-function} and @code{buffer-stale-function}, several problems usually remain. The buffer will only auto-revert if it is marked unmodified. Hence, diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 3b9aefa332b..9310c44f1e6 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -594,8 +594,8 @@ directory. Emacs creates the directory, if necessary, to make the backup. @vindex make-backup-file-name-function - If you define the variable @code{make-backup-file-name-function} to -a suitable Lisp function, that overrides the usual way Emacs + If you set the variable @code{make-backup-file-name-function} to +a suitable Lisp function, you can override the usual way Emacs constructs backup file names. @node Backup Deletion diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index e7bff6c28a4..52e5b9c4045 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -759,7 +759,9 @@ customizations. One way to record the input to Emacs precisely is to write a dribble file. To start the file, use the @kbd{M-x open-dribble-file @key{RET}} command. From then on, Emacs copies all your input to the -specified dribble file until the Emacs process is killed. +specified dribble file until the Emacs process is killed. Be aware +that sensitive information (such as passwords) may end up recorded in +the dribble file. @item @findex open-termscript diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 933078e9229..cb274474973 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,14 @@ +2014-04-05 Glenn Morris <rgm@gnu.org> + + * os.texi (Recording Input): Dribble files may contain passwords. + +2014-04-04 Glenn Morris <rgm@gnu.org> + + * backups.texi (Making Backups, Reverting): + Update for default values of some -function vars no longer being nil. + (Reverting): Update for buffer-stale-function + also applying to file-buffers. + 2014-03-31 Daniel Colascione <dancol@dancol.org> * minibuf.texi (Completion in Buffers): Discuss using lazy diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index 83ffb2f95e4..63f8f227c84 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi @@ -90,8 +90,7 @@ save disk space. (You would put this code in your init file.) @smallexample @group (add-hook 'rmail-mode-hook - (lambda () - (set (make-local-variable 'make-backup-files) nil))) + (lambda () (setq-local make-backup-files nil))) @end group @end smallexample @end defopt @@ -150,13 +149,12 @@ ignored. @end defopt @defopt make-backup-file-name-function -This variable's value is a function to use for making backups instead -of the default @code{make-backup-file-name}. A value of @code{nil} -gives the default @code{make-backup-file-name} behavior. +This variable's value is a function to use for making backup file names. +The function @code{make-backup-file-name} calls it. @xref{Backup Names,, Naming Backup Files}. This could be buffer-local to do something special for specific -files. If you define it, you may need to change +files. If you change it, you may need to change @code{backup-file-name-p} and @code{file-name-sans-versions} too. @end defopt @@ -727,25 +725,24 @@ buffer-local bindings for these variables: @defvar revert-buffer-function @anchor{Definition of revert-buffer-function} The value of this variable is the function to use to revert this -buffer. If non-@code{nil}, it should be a function with two optional +buffer. It should be a function with two optional arguments to do the work of reverting. The two optional arguments, @var{ignore-auto} and @var{noconfirm}, are the arguments that -@code{revert-buffer} received. If the value is @code{nil}, reverting -works the usual way. +@code{revert-buffer} received. Modes such as Dired mode, in which the text being edited does not consist of a file's contents but can be regenerated in some other -fashion, can give this variable a buffer-local value that is a function to -regenerate the contents. +fashion, can give this variable a buffer-local value that is a special +function to regenerate the contents. @end defvar @defvar revert-buffer-insert-file-contents-function -The value of this variable, if non-@code{nil}, specifies the function to use to +The value of this variable specifies the function to use to insert the updated contents when reverting this buffer. The function receives two arguments: first the file name to use; second, @code{t} if the user has asked to read the auto-save file. -The reason for a mode to set this variable instead of +The reason for a mode to change this variable instead of @code{revert-buffer-function} is to avoid duplicating or replacing the rest of what @code{revert-buffer} does: asking for confirmation, clearing the undo list, deciding the proper major mode, and running the @@ -753,21 +750,23 @@ hooks listed below. @end defvar @defvar before-revert-hook -This normal hook is run by @code{revert-buffer} before -inserting the modified contents---but only if -@code{revert-buffer-function} is @code{nil}. +This normal hook is run by the default @code{revert-buffer-function} +before inserting the modified contents. A custom @code{revert-buffer-function} +may or may not run this hook. @end defvar @defvar after-revert-hook -This normal hook is run by @code{revert-buffer} after inserting -the modified contents---but only if @code{revert-buffer-function} is -@code{nil}. +This normal hook is run by the default @code{revert-buffer-function} +after inserting the modified contents. A custom @code{revert-buffer-function} +may or may not run this hook. @end defvar @c FIXME? Move this section from arevert-xtra to here? @defvar buffer-stale-function -The value of this variable, if non-@code{nil}, specifies a function -to call to check whether a non-file buffer needs reverting +The value of this variable specifies a function to call to check +whether a buffer needs reverting. The default value only handles +buffers that are visiting files, by checking their modification time. +Buffers that are not visiting files require a custom function @iftex (@pxref{Supporting additional buffers,,, emacs-xtra, Specialized Emacs Features}). @end iftex diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index cad5d7ec544..b63b932b4da 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -2001,20 +2001,11 @@ This function opens a @dfn{dribble file} named @var{filename}. When a dribble file is open, each input event from the keyboard or mouse (but not those from keyboard macros) is written in that file. A non-character event is expressed using its printed representation -surrounded by @samp{<@dots{}>}. +surrounded by @samp{<@dots{}>}. Be aware that sensitive information +(such as passwords) may end up recorded in the dribble file. You close the dribble file by calling this function with an argument of @code{nil}. - -This function is normally used to record the input necessary to -trigger an Emacs bug, for the sake of a bug report. - -@example -@group -(open-dribble-file "~/dribble") - @result{} nil -@end group -@end example @end deffn See also the @code{open-termscript} function (@pxref{Terminal Output}). @@ -219,6 +219,10 @@ You can change the default by customizing `blink-cursor-blinks'. ** In keymaps where SPC scrolls forward, S-SPC now scrolls backward. This affects View mode, etc. ++++ +** The default value of `make-backup-file-name-function' is no longer nil. +Instead it defaults to a function that does what the nil value used to. + ** Help changes +++ @@ -1457,9 +1461,13 @@ argument, with the same interpretation as the returned value of ** Revert and Autorevert changes -*** The default value of `revert-buffer-function' is no longer nil. -Instead it defaults to a function that does what the nil value used to. -The same applies for `revert-buffer-insert-file-contents-function'. ++++ +*** The default values of `buffer-stale-function', `revert-buffer-function', +and `revert-buffer-insert-file-contents-function' are no longer nil. +Instead they default to functions that do what the nil value used to. + ++++ +*** `buffer-stale-function' is now used for buffers visiting files too. --- *** If Emacs is compiled with file notification support, it uses notifications diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87f3c74c9fc..e4df943c1bf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,128 @@ +2014-04-07 João Távora <joaotavora@gmail.com> + + * elec-pair.el: + (electric-pair--syntax-ppss): When inside comments parse from + comment beginning. + (electric-pair--balance-info): Fix typo in comment. + (electric-pair--in-unterminated-string-p): Delete. + (electric-pair--unbalanced-strings-p): New function. + (electric-pair-string-bound-function): New var. + (electric-pair-inhibit-if-helps-balance): Decide quote pairing + according to `electric-pair--in-unterminated-string-p' + +2014-04-07 João Távora <joaotavora@gmail.com> + + * elec-pair.el (electric-pair-inhibit-if-helps-balance): Inhibit + quote pairing if point-max is inside an unterminated string. + (electric-pair--looking-at-unterminated-string-p): + Delete. + (electric-pair--in-unterminated-string-p): New function. + +2014-04-07 Glenn Morris <rgm@gnu.org> + + * shell.el (shell-directory-tracker): + Go back to just ignoring failures. (Bug#17159) + +2014-04-06 João Távora <joaotavora@gmail.com> + + Fix `electric-pair-delete-adjacent-pairs' in modes binding + backspace. (bug#16981) + * elec-pair.el (electric-pair-backward-delete-char): Delete. + (electric-pair-backward-delete-char-untabify): Delete. + (electric-pair-mode-map): Bind backspace to a menu item filtering + a new `electric-pair-delete-pair' command. + (electric-pair-delete-pair): New command. + +2014-04-06 João Távora <joaotavora@gmail.com> + + * progmodes/python.el (python-electric-pair-string-delimiter): Fix + triple-quoting electricity. (Bug#17192) + +2014-04-06 João Távora <joaotavora@gmail.com> + + * elec-pair.el (electric-pair-post-self-insert-function): Don't + skip whitespace when `electric-pair-text-pairs' and + `electric-pair-pairs' were used. syntax to + electric-pair--skip-whitespace. (Bug#17183) + +2014-04-06 Eli Zaretskii <eliz@gnu.org> + + * leim/quail/ipa.el (ipa-x-sampa): Fix the character produced for + "<F>". (Bug#17199) + +2014-04-06 Stefan Monnier <monnier@iro.umontreal.ca> + + * mpc.el (mpc--status-timer-run): Disable timer if not displayed. + (mpc--status-idle-timer-run): Use mpc--status-timer-run. + +2014-04-05 Glenn Morris <rgm@gnu.org> + + * help.el (view-lossage): Doc tweak. + +2014-04-05 Matthias Dahl <ml_emacs-lists@binary-island.eu> + + * faces.el (face-spec-recalc): Call make-face-x-resource-internal + only when inhibit-x-resources is nil, and do that earlier in the + function. Doc fix. (Bug#16694) + (face-spec-choose): Accept additional optional argument, whose + value is returned if no matching attributes are found. + (face-spec-recalc): Use the new optional argument when calling + face-spec-choose. (Bug#16378) + (make-face-x-resource-internal): Do nothing when + inhibit-x-resources is non-nil. Don't touch the default face if + reversed video is given--as was done in previous versions of Emacs. + (face-set-after-frame-default): Don't call + make-face-x-resource-internal here. (Bug#16434) + +2014-04-04 Tassilo Horn <tsdh@gnu.org> + + * doc-view.el (doc-view-bookmark-jump): + Use `bookmark-after-jump-hook' to jump to the right page after the + buffer is shown in a window. (bug#16090) + +2014-04-04 Eli Zaretskii <eliz@gnu.org> + + * international/characters.el (mirroring): Fix last change: + instead of loading uni-mirrored.el explicitly, do that implicitly + by creating the 'mirroring' uniprop table. This avoids announcing + the loading of uni-mirrored.el. + +2014-04-04 Glenn Morris <rgm@gnu.org> + + * files.el (buffer-stale--default-function) + (buffer-stale-function, revert-buffer--default): + * autorevert.el (auto-revert-buffers): Doc tweaks. + +2014-04-03 Eli Zaretskii <eliz@gnu.org> + + * international/characters.el: Preload uni-mirrored.el. (Bug#17169) + +2014-04-03 Glenn Morris <rgm@gnu.org> + + * files.el (make-backup-file-name-function) + (make-backup-file-name, make-backup-file-name--default-function) + (make-backup-file-name-1, find-backup-file-name) + (revert-buffer-function, revert-buffer-insert-file-contents-function) + (buffer-stale--default-function, buffer-stale-function) + (before-revert-hook, after-revert-hook, revert-buffer-in-progress-p) + (revert-buffer, revert-buffer--default) + (revert-buffer-insert-file-contents--default-function): + Doc fixes related to defaults no longer being nil. + (make-backup-file-name-function): Bump :version. + Restore nil as a valid but deprecated custom type. + +2014-04-03 Stefan Monnier <monnier@iro.umontreal.ca> + + * progmodes/perl-mode.el (perl-syntax-propertize-function): Handle $' + used as a variable (bug#17174). + +2014-04-02 Stefan Monnier <monnier@iro.umontreal.ca> + + * progmodes/perl-mode.el (perl-indent-new-calculate): + Handle forward-sexp failure (bug#16985). + (perl-syntax-propertize-function): Add "foreach" and "for" statement + modifiers introducing expressions (bug#17116). + 2014-04-06 Stefan Monnier <monnier@iro.umontreal.ca> * dired-aux.el (dired-file-set-difference): Use lexical-scoping. @@ -488,6 +613,19 @@ (tty-color-approximate, tty-color-by-index, tty-color-values) (tty-color-desc): Remove superfluous backslashes. +2014-03-20 Stefan Monnier <monnier@iro.umontreal.ca> + + * electric.el (electric-newline-and-maybe-indent): New command. + Bind it globally to C-j. + (electric-indent-mode): Don't mess with the global map any more. + Don't drop the post-self-insert-hook is some buffer is still using it + (bug#16770). + + * bindings.el (global-map): Remove C-j binding. + + * emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find + the docstring of functions advised before dumping (bug#16993). + 2014-03-21 Glenn Morris <rgm@gnu.org> * cus-start.el (history-length): Bump :version. @@ -516,18 +654,6 @@ * skeleton.el (skeleton-autowrap): Mark as obsolete. Doc fix. -2014-03-20 Stefan Monnier <monnier@iro.umontreal.ca> - - * electric.el (electric-newline-and-maybe-indent): New command. - Bind it globally to C-j. - (electric-indent-mode): Don't mess with the global map any more. - Don't drop the post-self-insert-hook is some buffer is still using it - (bug#16770). - * bindings.el (global-map): Remove C-j binding. - - * emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find - the docstring of functions advised before dumping (bug#16993). - 2014-03-19 Stefan-W. Hahn <stefan.hahn@s-hahn.de> (tiny change) * ps-print.el (ps-generate-postscript-with-faces): @@ -2154,7 +2280,6 @@ * net/shr.el (shr-tag-img): Prefer the title over the alt text (bug#16537). ->>>>>>> MERGE-SOURCE 2014-01-24 Juanma Barranquero <lekktu@gmail.com> * net/eww.el (eww-download-callback): diff --git a/lisp/autorevert.el b/lisp/autorevert.el index a08bf7fee6a..f1074e22e51 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -672,7 +672,7 @@ Should `auto-revert-mode' be active in some buffers, those buffers are checked. Non-file buffers that have a custom `revert-buffer-function' and -a `buffer-stale-function' are reverted either when Auto-Revert +`buffer-stale-function' are reverted either when Auto-Revert Mode is active in that buffer, or when the variable `global-auto-revert-non-file-buffers' is non-nil and Global Auto-Revert Mode is active. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 6706865e598..09d5925b3e2 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1862,20 +1862,23 @@ See the command `doc-view-mode' for more information on this mode." `((page . ,(doc-view-current-page)) (handler . doc-view-bookmark-jump)))) - ;;;###autoload (defun doc-view-bookmark-jump (bmk) ;; This implements the `handler' function interface for record type ;; returned by `doc-view-bookmark-make-record', which see. - (prog1 (bookmark-default-handler bmk) - (let ((page (bookmark-prop-get bmk 'page))) - (when (not (eq major-mode 'doc-view-mode)) - (doc-view-toggle-display)) - (with-selected-window - (or (get-buffer-window (current-buffer) 0) - (selected-window)) - (doc-view-goto-page page))))) - + (let ((page (bookmark-prop-get bmk 'page)) + (show-fn-sym (make-symbol "doc-view-bookmark-after-jump-hook"))) + (fset show-fn-sym + (lambda () + (remove-hook 'bookmark-after-jump-hook show-fn-sym) + (when (not (eq major-mode 'doc-view-mode)) + (doc-view-toggle-display)) + (with-selected-window + (or (get-buffer-window (current-buffer) 0) + (selected-window)) + (doc-view-goto-page page)))) + (add-hook 'bookmark-after-jump-hook show-fn-sym) + (bookmark-default-handler bmk))) (provide 'doc-view) diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el index 73eabdf51c8..c16c1141800 100644 --- a/lisp/elec-pair.el +++ b/lisp/elec-pair.el @@ -166,36 +166,6 @@ return value is considered instead." quotes or comments. If lookup fails here, `electric-pair-text-pairs' will be considered.") -(defun electric-pair-backward-delete-char (n &optional killflag untabify) - "Delete characters backward, and maybe also two adjacent paired delimiters. - -Remaining behavior is given by `backward-delete-char' or, if UNTABIFY is -non-nil, `backward-delete-char-untabify'." - (interactive "*p\nP") - (let* ((prev (char-before)) - (next (char-after)) - (syntax-info (and prev - (electric-pair-syntax-info prev))) - (syntax (car syntax-info)) - (pair (cadr syntax-info))) - (when (and next pair - (if (functionp electric-pair-delete-adjacent-pairs) - (funcall electric-pair-delete-adjacent-pairs) - electric-pair-delete-adjacent-pairs) - (memq syntax '(?\( ?\" ?\$)) - (eq pair next)) - (delete-char 1 killflag)) - (if untabify - (backward-delete-char-untabify n killflag) - (backward-delete-char n killflag)))) - -(defun electric-pair-backward-delete-char-untabify (n &optional killflag) - "Delete characters backward, and maybe also two adjacent paired delimiters. - -Remaining behavior is given by `backward-delete-char-untabify'." - (interactive "*p\nP") - (electric-pair-backward-delete-char n killflag t)) - (defun electric-pair-conservative-inhibit (char) (or ;; I find it more often preferable not to pair when the @@ -503,10 +473,12 @@ happened." (funcall electric-pair-skip-self last-command-event) electric-pair-skip-self)) (save-excursion - (when (setq skip-whitespace-info - (if (functionp electric-pair-skip-whitespace) - (funcall electric-pair-skip-whitespace) - electric-pair-skip-whitespace)) + (when (and (not (and unconditional + (eq syntax ?\"))) + (setq skip-whitespace-info + (if (functionp electric-pair-skip-whitespace) + (funcall electric-pair-skip-whitespace) + electric-pair-skip-whitespace))) (electric-pair--skip-whitespace)) (eq (char-after) last-command-event)))) ;; This is too late: rather than insert&delete we'd want to only @@ -546,14 +518,34 @@ happened." (memq (car (electric-pair-syntax-info last-command-event)) '(?\( ?\) ?\" ?\$)))) +(defun electric-pair-delete-pair (arg &optional killp) + "When between adjacent paired delimiters, delete both of them. +ARG and KILLP are passed directly to +`backward-delete-char-untabify', which see." + (interactive "*p\nP") + (delete-char 1) + (backward-delete-char-untabify arg killp)) + (defvar electric-pair-mode-map (let ((map (make-sparse-keymap))) - (define-key map [remap backward-delete-char-untabify] - 'electric-pair-backward-delete-char-untabify) - (define-key map [remap backward-delete-char] - 'electric-pair-backward-delete-char) - (define-key map [remap delete-backward-char] - 'electric-pair-backward-delete-char) + (define-key map "\177" + `(menu-item + "" electric-pair-delete-pair + :filter + ,(lambda (cmd) + (let* ((prev (char-before)) + (next (char-after)) + (syntax-info (and prev + (electric-pair-syntax-info prev))) + (syntax (car syntax-info)) + (pair (cadr syntax-info))) + (and next pair + (memq syntax '(?\( ?\" ?\$)) + (eq pair next) + (if (functionp electric-pair-delete-adjacent-pairs) + (funcall electric-pair-delete-adjacent-pairs) + electric-pair-delete-adjacent-pairs) + cmd))))) map) "Keymap used by `electric-pair-mode'.") diff --git a/lisp/faces.el b/lisp/faces.el index 49b59281576..b2f353d089e 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -354,11 +354,16 @@ specifies an invalid attribute." (defun make-face-x-resource-internal (face &optional frame) "Fill frame-local FACE on FRAME from X resources. -FRAME nil or not specified means do it for all frames." - (if (null frame) - (dolist (frame (frame-list)) - (set-face-attributes-from-resources face frame)) - (set-face-attributes-from-resources face frame))) +FRAME nil or not specified means do it for all frames. + +If `inhibit-x-resources' is non-nil, this function does nothing." + (unless inhibit-x-resources + (dolist (frame (if (null frame) (frame-list) (list frame))) + ;; `x-create-frame' already took care of correctly handling + ;; the reverse video case-- do _not_ touch the default face + (unless (and (eq face 'default) + (frame-parameter frame 'reverse)) + (set-face-attributes-from-resources face frame))))) @@ -1532,13 +1537,15 @@ If FRAME is nil, the current FRAME is used." match)) -(defun face-spec-choose (spec &optional frame) - "Choose the proper attributes for FRAME, out of SPEC. -If SPEC is nil, return nil." +(defun face-spec-choose (spec &optional frame no-match-retval) + "Return the proper attributes for FRAME, out of SPEC. + +If no match is found or SPEC is nil, return nil, unless NO-MATCH-RETVAL +is given, in which case return its value instead." (unless frame (setq frame (selected-frame))) (let ((tail spec) - result defaults) + result defaults match-found) (while tail (let* ((entry (pop tail)) (display (car entry)) @@ -1558,9 +1565,18 @@ If SPEC is nil, return nil." (setq defaults thisval) ;; Otherwise, if it matches, use it. (when (face-spec-set-match-display display frame) - (setq result thisval) - (setq tail nil))))) - (if defaults (append result defaults) result))) + (setq result thisval + tail nil + match-found t))))) + ;; If defaults have been found, it's safe to just append those to the result + ;; list (which at this point will be either nil or contain actual specs) and + ;; return it to the caller. Since there will most definitely be something to + ;; return in this case, there's no need to know/check if a match was found. + (if defaults + (append result defaults) + (if match-found + result + no-match-retval)))) (defun face-spec-reset-face (face &optional frame) @@ -1639,19 +1655,27 @@ function for its other effects." (defun face-spec-recalc (face frame) "Reset the face attributes of FACE on FRAME according to its specs. -This applies the defface/custom spec first, then the custom theme specs, -then the override spec." +After the reset, the specs are applied from the following sources in this order: + X resources (if applicable) + | + (theme and user customization) + or, if nonexistent or does not match the current frame, + (defface default spec) + | + defface override spec" (while (get face 'face-alias) (setq face (get face 'face-alias))) (face-spec-reset-face face frame) + (make-face-x-resource-internal face frame) ;; If FACE is customized or themed, set the custom spec from ;; `theme-face' records. (let ((theme-faces (get face 'theme-face)) + (no-match-found 0) spec theme-face-applied) (if theme-faces (dolist (elt (reverse theme-faces)) - (setq spec (face-spec-choose (cadr elt) frame)) - (when spec + (setq spec (face-spec-choose (cadr elt) frame no-match-found)) + (unless (eq spec no-match-found) (face-spec-set-2 face frame spec) (setq theme-face-applied t)))) ;; If there was a spec applicable to FRAME, that overrides the @@ -1661,8 +1685,7 @@ then the override spec." (setq spec (face-spec-choose (face-default-spec face) frame)) (face-spec-set-2 face frame spec)) (setq spec (face-spec-choose (get face 'face-override-spec) frame)) - (face-spec-set-2 face frame spec)) - (make-face-x-resource-internal face frame)) + (face-spec-set-2 face frame spec))) (defun face-spec-set-2 (face frame spec) "Set the face attributes of FACE on FRAME according to SPEC." @@ -2046,10 +2069,6 @@ frame parameters in PARAMETERS." (progn ;; Initialize faces from face spec and custom theme. (face-spec-recalc face frame) - ;; X resources for the default face are applied during - ;; `x-create-frame'. - (and (not (eq face 'default)) window-system-p - (make-face-x-resource-internal face frame)) ;; Apply attributes specified by face-new-frame-defaults (internal-merge-in-global-face face frame)) ;; Don't let invalid specs prevent frame creation. diff --git a/lisp/files.el b/lisp/files.el index 5883c8c348e..34c66bbd1d6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4207,15 +4207,22 @@ FILENAME defaults to `buffer-file-name'." (defcustom make-backup-file-name-function #'make-backup-file-name--default-function - "A function to use instead of the default `make-backup-file-name'. + "A function that `make-backup-file-name' uses to create backup file names. +The function receives a single argument, the original file name. -This could be buffer-local to do something special for specific -files. If you define it, you may need to change `backup-file-name-p' -and `file-name-sans-versions' too. +If you change this, you may need to change `backup-file-name-p' and +`file-name-sans-versions' too. + +You could make this buffer-local to do something special for specific files. + +For historical reasons, a value of nil means to use the default function. +This should not be relied upon. See also `backup-directory-alist'." + :version "24.4" ; nil -> make-backup-file-name--default-function :group 'backup - :type '(function :tag "Your function")) + :type '(choice (const :tag "Deprecated way to get the default function" nil) + (function :tag "Function"))) (defcustom backup-directory-alist nil "Alist of filename patterns and backup directory names. @@ -4272,20 +4279,17 @@ Checks for files in `temporary-file-directory', (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. -Normally this will just be the file's name with `~' appended. -Customization hooks are provided as follows. - -The value of `make-backup-file-name-function' should be a function which -will be called with FILE as its argument; the resulting name is used. - -By default, a match for FILE is sought in `backup-directory-alist'; see -the documentation of that variable. If the directory for the backup -doesn't exist, it is created." +This calls the function that `make-backup-file-name-function' specifies, +with a single argument FILE." (funcall (or make-backup-file-name-function #'make-backup-file-name--default-function) file)) (defun make-backup-file-name--default-function (file) + "Default function for `make-backup-file-name'. +Normally this just returns FILE's name with `~' appended. +It searches for a match for FILE in `backup-directory-alist'. +If the directory for the backup doesn't exist, it is created." (if (and (eq system-type 'ms-dos) (not (msdos-long-file-names))) (let ((fn (file-name-nondirectory file))) @@ -4297,7 +4301,8 @@ doesn't exist, it is created." (concat (make-backup-file-name-1 file) "~"))) (defun make-backup-file-name-1 (file) - "Subroutine of `make-backup-file-name' and `find-backup-file-name'." + "Subroutine of `make-backup-file-name--default-function'. +The function `find-backup-file-name' also uses this." (let ((alist backup-directory-alist) elt backup-directory abs-backup-directory) (while alist @@ -4374,8 +4379,8 @@ the index in the name where the version number begins." Value is a list whose car is the name for the backup file and whose cdr is a list of old versions to consider deleting now. If the value is nil, don't make a backup. -Uses `backup-directory-alist' in the same way as does -`make-backup-file-name'." +Uses `backup-directory-alist' in the same way as +`make-backup-file-name--default-function' does." (let ((handler (find-file-name-handler fn 'find-backup-file-name))) ;; Run a handler for this function so that ange-ftp can refuse to do it. (if handler @@ -5312,28 +5317,41 @@ comparison." (put 'revert-buffer-function 'permanent-local t) (defvar revert-buffer-function #'revert-buffer--default - "Function to use to revert this buffer, or nil to do the default. + "Function to use to revert this buffer. The function receives two arguments IGNORE-AUTO and NOCONFIRM, which are the arguments that `revert-buffer' received. It also has access to the `preserve-modes' argument of `revert-buffer' -via the `revert-buffer-preserve-modes' dynamic variable.") +via the `revert-buffer-preserve-modes' dynamic variable. + +For historical reasons, a value of nil means to use the default function. +This should not be relied upon.") (put 'revert-buffer-insert-file-contents-function 'permanent-local t) (defvar revert-buffer-insert-file-contents-function #'revert-buffer-insert-file-contents--default-function "Function to use to insert contents when reverting this buffer. -Gets two args, first the nominal file name to use, -and second, t if reading the auto-save file. +The function receives two arguments: the first the nominal file name to use; +the second is t if reading the auto-save file. + +The function is responsible for updating (or preserving) point. -The function you specify is responsible for updating (or preserving) point.") +For historical reasons, a value of nil means to use the default function. +This should not be relied upon.") (defun buffer-stale--default-function (&optional _noconfirm) + "Default function to use for `buffer-stale-function'. +This function ignores its argument. +This returns non-nil if the current buffer is visiting a readable file +whose modification time does not match that of the buffer. + +This function only handles buffers that are visiting files. +Non-file buffers need a custom function" (and buffer-file-name (file-readable-p buffer-file-name) (not (verify-visited-file-modtime (current-buffer))))) (defvar buffer-stale-function #'buffer-stale--default-function - "Function to check whether a non-file buffer needs reverting. + "Function to check whether a buffer needs reverting. This should be a function with one optional argument NOCONFIRM. Auto Revert Mode passes t for NOCONFIRM. The function should return non-nil if the buffer should be reverted. A return value of @@ -5346,13 +5364,16 @@ non-nil if the buffer is going to be reverted without asking the user. In such situations, one has to be careful with potentially time consuming operations. +For historical reasons, a value of nil means to use the default function. +This should not be relied upon. + For more information on how this variable is used by Auto Revert mode, see Info node `(emacs)Supporting additional buffers'.") (defvar before-revert-hook nil "Normal hook for `revert-buffer' to run before reverting. -If `revert-buffer-function' is used to override the normal revert -mechanism, this hook is not used.") +The function `revert-buffer--default' runs this. +A customized `revert-buffer-function' need not run this hook.") (defvar after-revert-hook nil "Normal hook for `revert-buffer' to run after reverting. @@ -5360,12 +5381,11 @@ Note that the hook value that it runs is the value that was in effect before reverting; that makes a difference if you have buffer-local hook functions. -If `revert-buffer-function' is used to override the normal revert -mechanism, this hook is not used.") +The function `revert-buffer--default' runs this. +A customized `revert-buffer-function' need not run this hook.") (defvar revert-buffer-in-progress-p nil - "Non-nil if a `revert-buffer' operation is in progress, nil otherwise. -This is true even if a `revert-buffer-function' is being used.") + "Non-nil if a `revert-buffer' operation is in progress, nil otherwise.") (defvar revert-buffer-internal-hook) @@ -5402,12 +5422,10 @@ the files modes. Normally we reinitialize them using `normal-mode'. This function binds `revert-buffer-in-progress-p' non-nil while it operates. -If the value of `revert-buffer-function' is non-nil, it is called to -do all the work for this command. Otherwise, the hooks -`before-revert-hook' and `after-revert-hook' are run at the beginning -and the end, and if `revert-buffer-insert-file-contents-function' is -non-nil, it is called instead of rereading visited file contents." - +This function calls the function that `revert-buffer-function' specifies +to do the work, with arguments IGNORE-AUTO and NOCONFIRM. +The default function runs the hooks `before-revert-hook' and +`after-revert-hook'." ;; I admit it's odd to reverse the sense of the prefix argument, but ;; there is a lot of code out there which assumes that the first ;; argument should be t to avoid consulting the auto-save file, and @@ -5419,7 +5437,19 @@ non-nil, it is called instead of rereading visited file contents." (revert-buffer-preserve-modes preserve-modes)) (funcall (or revert-buffer-function #'revert-buffer--default) ignore-auto noconfirm))) + (defun revert-buffer--default (ignore-auto noconfirm) + "Default function for `revert-buffer'. +The arguments IGNORE-AUTO and NOCONFIRM are as described for `revert-buffer'. +Runs the hooks `before-revert-hook' and `after-revert-hook' at the +start and end. + +Calls `revert-buffer-insert-file-contents-function' to reread the +contents of the visited file, with two arguments: the first is the file +name, the second is non-nil if reading an auto-save file. + +This function only handles buffers that are visiting files. +Non-file buffers need a custom function." (with-current-buffer (or (buffer-base-buffer (current-buffer)) (current-buffer)) (let* ((auto-save-p (and (not ignore-auto) @@ -5473,6 +5503,10 @@ non-nil, it is called instead of rereading visited file contents." t))))) (defun revert-buffer-insert-file-contents--default-function (file-name auto-save-p) + "Default function for `revert-buffer-insert-file-contents-function'. +The function `revert-buffer--default' calls this. +FILE-NAME is the name of the file. AUTO-SAVE-P is non-nil if this is +an auto-save file." (cond ((not (file-exists-p file-name)) (error (if buffer-file-number diff --git a/lisp/help.el b/lisp/help.el index 4434ce27bdb..76c27de8da6 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -446,7 +446,7 @@ is specified by the variable `message-log-max'." (defun view-lossage () "Display last 300 input keystrokes. -To record all your input on a file, use `open-dribble-file'." +To record all your input, use `open-dribble-file'." (interactive) (help-setup-xref (list #'view-lossage) (called-interactively-p 'interactive)) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 2b656375ca2..54ab362df04 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -495,6 +495,13 @@ with L, LRE, or LRO Unicode bidi character type.") (modify-category-entry key ?L)))) table))) +;; Load uni-mirrored.el if available, so that it gets dumped into +;; Emacs. This allows to start Emacs with force-load-messages in +;; ~/.emacs, and avoid infinite recursion in bidi_initialize, which +;; needs to load uni-mirrored.el in order to display the "Loading" +;; messages. +(unicode-property-table-internal 'mirroring) + ;; Latin (modify-category-entry '(#x80 . #x024F) ?l) diff --git a/lisp/leim/quail/ipa.el b/lisp/leim/quail/ipa.el index 322f34ad33e..e0e1c9f0c56 100644 --- a/lisp/leim/quail/ipa.el +++ b/lisp/leim/quail/ipa.el @@ -475,7 +475,7 @@ displays them, incorrectly, as separate from the modified glyphs.") ("_d" "̪") ;; Dental U+032A ("_e" "̴") ;; Velarized or pharyngeal U+0334 - ("<F>" "↙") ;; Global fall; SOUTH EAST ARROW; may be a bit smaller than + ("<F>" "↘") ;; Global fall; SOUTH EAST ARROW; may be a bit smaller than ;; intended. ("_F" "̂") ;; Falling tone U+0302 ("_G" "ˠ") ;; Velarized U+02E0 diff --git a/lisp/mpc.el b/lisp/mpc.el index 921b5fc8b89..d89231e81b9 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -491,9 +491,13 @@ to call FUN for any change whatsoever.") (cancel-timer mpc--status-timer) (setq mpc--status-timer nil))) (defun mpc--status-timer-run () - (with-demoted-errors "MPC: %s" + (with-demoted-errors "MPC: %S" (when (process-get (mpc-proc) 'ready) - (with-local-quit (mpc-status-refresh))))) + (let* ((buf (mpc-proc-buffer (mpc-proc) 'status)) + (win (get-buffer-window buf t))) + (if (not win) + (mpc--status-timer-stop) + (with-local-quit (mpc-status-refresh))))))) (defvar mpc--status-idle-timer nil) (defun mpc--status-idle-timer-start () @@ -518,10 +522,8 @@ to call FUN for any change whatsoever.") ;; client starts playback, we may get a chance to notice it. (run-with-idle-timer 10 t 'mpc--status-idle-timer-run)))) (defun mpc--status-idle-timer-run () - (when (process-get (mpc-proc) 'ready) - (with-demoted-errors "MPC: %s" - (with-local-quit (mpc-status-refresh)))) - (mpc--status-timer-start)) + (mpc--status-timer-start) + (mpc--status-timer-run)) (defun mpc--status-timers-refresh () "Start/stop the timers according to whether a song is playing." diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index d09fb59371a..3486c0a1983 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -250,7 +250,11 @@ ;; Catch ${ so that ${var} doesn't screw up indentation. ;; This also catches $' to handle 'foo$', although it should really ;; check that it occurs inside a '..' string. - ("\\(\\$\\)[{']" (1 ". p")) + ("\\(\\$\\)[{']" (1 (unless (and (eq ?\' (char-after (match-end 1))) + (save-excursion + (not (nth 3 (syntax-ppss + (match-beginning 0)))))) + (string-to-syntax ". p")))) ;; Handle funny names like $DB'stop. ("\\$ ?{?^?[_[:alpha:]][_[:alnum:]]*\\('\\)[_[:alpha:]]" (1 "_")) ;; format statements @@ -276,7 +280,7 @@ ;; perl-font-lock-special-syntactic-constructs. ((concat "\\(?:\\(?:^\\|[^$@&%[:word:]]\\)" (regexp-opt '("split" "if" "unless" "until" "while" "split" - "grep" "map" "not" "or" "and")) + "grep" "map" "not" "or" "and" "for" "foreach")) "\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)") (2 (ignore (if (and (match-end 1) ; / at BOL. @@ -854,11 +858,12 @@ changed by, or (parse-state) if line starts in a quoted string." (and (= (char-syntax (following-char)) ?\)) (save-excursion (forward-char 1) - (forward-sexp -1) - (perl-indent-new-calculate - ;; Recalculate the parsing-start, since we may have jumped - ;; dangerously close (typically in the case of nested functions). - 'virtual nil (save-excursion (perl-beginning-of-function))))) + (when (condition-case nil (progn (forward-sexp -1) t) + (scan-error nil)) + (perl-indent-new-calculate + ;; Recalculate the parsing-start, since we may have jumped + ;; dangerously close (typically in the case of nested functions). + 'virtual nil (save-excursion (perl-beginning-of-function)))))) (and (and (= (following-char) ?{) (save-excursion (forward-char) (perl-hanging-paren-p))) (+ (or default (perl-calculate-indent parse-start)) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b0102c55ffd..240cf8aff8c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3651,8 +3651,9 @@ returned as is." (let ((count 0)) (while (eq (char-before (- (point) count)) last-command-event) (cl-incf count)) - (= count 3))) - (save-excursion (insert (make-string 3 last-command-event))))) + (= count 3)) + (eq (char-after) last-command-event)) + (save-excursion (insert (make-string 2 last-command-event))))) (defvar electric-indent-inhibit) diff --git a/lisp/shell.el b/lisp/shell.el index c5c1275f19f..9dc9a013f8b 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -792,8 +792,11 @@ and `shell-pushd-dunique' control the behavior of the relevant command. Environment variables are expanded, see function `substitute-in-file-name'." (if shell-dirtrackp ;; We fail gracefully if we think the command will fail in the shell. - (with-demoted-errors "Couldn't cd: %s" - (let ((start (progn (string-match +;;; (with-demoted-errors "Directory tracker failure: %s" + ;; This fails so often that it seems better to just ignore errors (?). + ;; Eg even: foo=/tmp; cd $foo is beyond us (bug#17159). + (ignore-errors + (let ((start (progn (string-match (concat "^" shell-command-separator-regexp) str) ; skip whitespace (match-end 0))) diff --git a/nt/ChangeLog b/nt/ChangeLog index 62a33906b0d..8e2875805dd 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2014-04-03 Ken Brown <kbrown@cornell.edu> + + * emacs.rc: Don't use manifest on Cygwin. (Bug#17176) + 2014-02-17 Juanma Barranquero <lekktu@gmail.com> * Makefile.in (install): Create destination directory before copying diff --git a/nt/emacs.rc b/nt/emacs.rc index 2d007ba9043..f363e6aad78 100644 --- a/nt/emacs.rc +++ b/nt/emacs.rc @@ -1,10 +1,12 @@ Emacs ICON icons/emacs.ico 32649 CURSOR icons/hand.cur -#if defined (WIN64) || defined (__x86_64__) +#ifndef __CYGWIN__ +#ifdef WIN64 1 24 "emacs-x64.manifest" #else 1 24 "emacs-x86.manifest" #endif +#endif #ifndef VS_VERSION_INFO #define VS_VERSION_INFO 1 diff --git a/src/ChangeLog b/src/ChangeLog index b4722839fe3..d0d133c4989 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,37 @@ +2014-04-07 Stefan Monnier <monnier@iro.umontreal.ca> + + * lisp.h (struct Lisp_Symbol): New bitfield `pinned'. + + * alloc.c: Keep track of symbols referenced from pure space (bug#17168). + (symbol_block_pinned): New var. + (Fmake_symbol): Initialize `pinned'. + (purecopy): New function, extracted from Fpurecopy. Mark symbols as + pinned and signal an error for un-purifiable objects. + (pure_cons): Use it. + (Fpurecopy): Use it, except for objects that can't be purified. + (mark_pinned_symbols): New function. + (Fgarbage_collect): Use it. + (gc_sweep): Remove hack made unnecessary. + +2014-04-05 Glenn Morris <rgm@gnu.org> + + * keyboard.c (Fopen_dribble_file): Doc tweak. + +2014-04-04 Jan Djärv <jan.h.d@swipnet.se> + + Backport from trunk. + * nsterm.m (updateFrameSize:): If waiting for the tool bar and tool + bar is zero height, just return (Bug#16976). + (initFrameFromEmacs:): Initialize wait_for_tool_bar. + * nsterm.h (EmacsView): Add wait_for_tool_bar. + * nsmenu.m (update_frame_tool_bar): Return early if view or toolbar + is nil. If waiting for toolbar to complete, force a redraw. + (free_frame_tool_bar): Set wait_for_tool_bar = NO (Bug#16976). + +2014-04-03 Ken Brown <kbrown@cornell.edu> + + * Makefile.in (EMACS_MANIFEST): Update comment. (Bug#17176) + 2014-04-07 Paul Eggert <eggert@cs.ucla.edu> * alloc.c: Simplify by removing use of HAVE_EXECINFO_H. @@ -4490,7 +4524,7 @@ * frame.c (delete_frame): Block/unblock input to overcome race condition (Bug#15475). -2013-09-29 Andreas Politz <politza@hochschule-trier.de> (tiny change) +2013-09-29 Andreas Politz <politza@hochschule-trier.de> * frame.c (delete_frame): Record selected frame only after calling Qdelete_frame_functions (Bug#15477). diff --git a/src/Makefile.in b/src/Makefile.in index 388923596c9..7e71d030279 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -259,7 +259,7 @@ W32_LIBS=@W32_LIBS@ ## emacs.res if HAVE_W32 EMACSRES = @EMACSRES@ -## emacs-*.manifest if HAVE_W32 +## emacs-*.manifest if WINDOWSNT EMACS_MANIFEST = @EMACS_MANIFEST@ ## If HAVE_W32, compiler arguments for including ## the resource file in the binary. diff --git a/src/alloc.c b/src/alloc.c index dbd1ece5d49..ea8d81648d7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3357,6 +3357,13 @@ struct symbol_block static struct symbol_block *symbol_block; static int symbol_block_index = SYMBOL_BLOCK_SIZE; +/* Pointer to the first symbol_block that contains pinned symbols. + Tests for 24.4 showed that at dump-time, Emacs contains about 15K symbols, + 10K of which are pinned (and all but 250 of them are interned in obarray), + whereas a "typical session" has in the order of 30K symbols. + `symbol_block_pinned' lets mark_pinned_symbols scan only 15K symbols rather + than 30K to find the 10K symbols we need to mark. */ +static struct symbol_block *symbol_block_pinned; /* List of free symbols. */ @@ -3409,10 +3416,11 @@ Its value is void, and its function definition and property list are nil. */) SET_SYMBOL_VAL (p, Qunbound); set_symbol_function (val, Qnil); set_symbol_next (val, NULL); - p->gcmarkbit = 0; + p->gcmarkbit = false; p->interned = SYMBOL_UNINTERNED; p->constant = 0; - p->declared_special = 0; + p->declared_special = false; + p->pinned = false; consing_since_gc += sizeof (struct Lisp_Symbol); symbols_consed++; total_free_symbols--; @@ -5214,6 +5222,8 @@ make_pure_c_string (const char *data, ptrdiff_t nchars) return string; } +static Lisp_Object purecopy (Lisp_Object obj); + /* Return a cons allocated from pure space. Give it pure copies of CAR as car and CDR as cdr. */ @@ -5223,8 +5233,8 @@ pure_cons (Lisp_Object car, Lisp_Object cdr) Lisp_Object new; struct Lisp_Cons *p = pure_alloc (sizeof *p, Lisp_Cons); XSETCONS (new, p); - XSETCAR (new, Fpurecopy (car)); - XSETCDR (new, Fpurecopy (cdr)); + XSETCAR (new, purecopy (car)); + XSETCDR (new, purecopy (cdr)); return new; } @@ -5265,9 +5275,19 @@ Does not copy symbols. Copies strings without text properties. */) { if (NILP (Vpurify_flag)) return obj; - - if (PURE_POINTER_P (XPNTR (obj))) + else if (MARKERP (obj) || OVERLAYP (obj) + || HASH_TABLE_P (obj) || SYMBOLP (obj)) + /* Can't purify those. */ return obj; + else + return purecopy (obj); +} + +static Lisp_Object +purecopy (Lisp_Object obj) +{ + if (PURE_POINTER_P (XPNTR (obj)) || INTEGERP (obj) || SUBRP (obj)) + return obj; /* Already pure. */ if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ { @@ -5295,7 +5315,7 @@ Does not copy symbols. Copies strings without text properties. */) size &= PSEUDOVECTOR_SIZE_MASK; vec = XVECTOR (make_pure_vector (size)); for (i = 0; i < size; i++) - vec->contents[i] = Fpurecopy (AREF (obj, i)); + vec->contents[i] = purecopy (AREF (obj, i)); if (COMPILEDP (obj)) { XSETPVECTYPE (vec, PVEC_COMPILED); @@ -5304,11 +5324,23 @@ Does not copy symbols. Copies strings without text properties. */) else XSETVECTOR (obj, vec); } - else if (MARKERP (obj)) - error ("Attempt to copy a marker to pure storage"); + else if (SYMBOLP (obj)) + { + if (!XSYMBOL (obj)->pinned) + { /* We can't purify them, but they appear in many pure objects. + Mark them as `pinned' so we know to mark them at every GC cycle. */ + XSYMBOL (obj)->pinned = true; + symbol_block_pinned = symbol_block; + } + return obj; + } else - /* Not purified, don't hash-cons. */ - return obj; + { + Lisp_Object args[2]; + args[0] = build_pure_c_string ("Don't know how to purify: %S"); + args[1] = obj; + Fsignal (Qerror, (Fcons (Fformat (2, args), Qnil))); + } if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */ Fputhash (obj, obj, Vpurify_flag); @@ -5471,6 +5503,24 @@ compact_undo_list (Lisp_Object list) return list; } +static void +mark_pinned_symbols (void) +{ + struct symbol_block *sblk; + int lim = (symbol_block_pinned == symbol_block + ? symbol_block_index : SYMBOL_BLOCK_SIZE); + + for (sblk = symbol_block_pinned; sblk; sblk = sblk->next) + { + union aligned_Lisp_Symbol *sym = sblk->symbols, *end = sym + lim; + for (; sym < end; ++sym) + if (sym->s.pinned) + mark_object (make_lisp_ptr (&sym->s, Lisp_Symbol)); + + lim = SYMBOL_BLOCK_SIZE; + } +} + DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", doc: /* Reclaim storage for Lisp objects no longer needed. Garbage collection happens automatically if you cons more than @@ -5573,6 +5623,7 @@ See Info node `(elisp)Garbage Collection'. */) for (i = 0; i < staticidx; i++) mark_object (*staticvec[i]); + mark_pinned_symbols (); mark_specpdl (); mark_terminals (); mark_kboards (); @@ -6574,12 +6625,7 @@ sweep_symbols (void) for (; sym < end; ++sym) { - /* Check if the symbol was created during loadup. In such a case - it might be pointed to by pure bytecode which we don't trace, - so we conservatively assume that it is live. */ - bool pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); - - if (!sym->s.gcmarkbit && !pure_p) + if (!sym->s.gcmarkbit) { if (sym->s.redirect == SYMBOL_LOCALIZED) xfree (SYMBOL_BLV (&sym->s)); @@ -6593,8 +6639,6 @@ sweep_symbols (void) else { ++num_used; - if (!pure_p) - eassert (!STRING_MARKED_P (XSTRING (sym->s.name))); sym->s.gcmarkbit = 0; } } diff --git a/src/bidi.c b/src/bidi.c index b96cc24bbd1..53c2dad1b6b 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -22,9 +22,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ A sequential implementation of the Unicode Bidirectional algorithm, (UBA) as per UAX#9, a part of the Unicode Standard. - Unlike the reference and most other implementations, this one is - designed to be called once for every character in the buffer or - string. + Unlike the Reference Implementation and most other implementations, + this one is designed to be called once for every character in the + buffer or string. That way, we can leave intact the design of the + Emacs display engine, whereby an iterator object is used to + traverse buffer or string text character by character, and generate + the necessary data for displaying each character in 'struct glyph' + objects. (See xdisp.c for the details of that iteration.) The + functions on this file replace the original linear iteration in the + logical order of the text with a non-linear iteration in the visual + order, i.e. in the order characters should be shown on display. The main entry point is bidi_move_to_visually_next. Each time it is called, it finds the next character in the visual order, and @@ -52,7 +59,182 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ A note about references to UAX#9 rules: if the reference says something like "X9/Retaining", it means that you need to refer to rule X9 and to its modifications described in the "Implementation - Notes" section of UAX#9, under "Retaining Format Codes". */ + Notes" section of UAX#9, under "Retaining Format Codes". + + Here's the overview of the design of the reordering engine + implemented by this file. + + Basic implementation structure + ------------------------------ + + The sequential processing steps described by UAX#9 are implemented + as recursive levels of processing, all of which examine the next + character in the logical order. This hierarchy of processing looks + as follows, from the innermost (deepest) to the outermost level, + omitting some subroutines used by each level: + + bidi_fetch_char -- fetch next character + bidi_resolve_explicit -- resolve explicit levels and directions + bidi_resolve_weak -- resolve weak types + bidi_resolve_neutral -- resolve neutral types + bidi_level_of_next_char -- resolve implicit levels + + Each level calls the level below it, and works on the result + returned by the lower level, including all of its sub-levels. + + Unlike all the levels below it, bidi_level_of_next_char can return + the information about either the next or previous character in the + logical order, depending on the current direction of scanning the + buffer or string. For the next character, it calls all the levels + below it; for the previous character, it uses the cache, described + below. + + Thus, the result of calling bidi_level_of_next_char is the resolved + level of the next or the previous character in the logical order. + Based on this information, the function bidi_move_to_visually_next + finds the next character in the visual order and updates the + direction in which the buffer is scanned, either forward or + backward, to find the next character to be displayed. (Text is + scanned backwards when it needs to be reversed for display, i.e. if + the visual order is the inverse of the logical order.) This + implements the last, reordering steps of the UBA, by successively + calling bidi_level_of_next_char until the character of the required + embedding level is found; the scan direction is dynamically updated + as a side effect. See the commentary before the 'while' loop in + bidi_move_to_visually_next, for the details. + + Fetching characters + ------------------- + + In a nutshell, fetching the next character boils down to calling + STRING_CHAR_AND_LENGTH, passing it the address of a buffer or + string position. See bidi_fetch_char. However, if the next + character is "covered" by a display property of some kind, + bidi_fetch_char returns the u+FFFC "object replacement character" + that represents the entire run of text covered by the display + property. (The ch_len and nchars members of 'struct bidi_it' + reflect the length in bytes and characters of that text.) This is + so we reorder text on both sides of the display property as + appropriate for an image or embedded string. Similarly, text + covered by a display spec of the form '(space ...)', is replaced + with the u+2029 paragraph separator character, so such display + specs produce the same effect as a TAB under UBA. Both these + special characters are not actually displayed -- the display + property is displayed instead -- but just used to compute the + embedding level of the surrounding text so as to produce the + required effect. + + Bidi iterator states + -------------------- + + The UBA is highly context dependent in some of its parts, + i.e. results of processing a character can generally depend on + characters very far away. The UAX#9 description of the UBA + prescribes a stateful processing of each character, whereby the + results of this processing depend on various state variables, such + as the current embedding level, level stack, and directional + override status. In addition, the UAX#9 description includes many + passages like this (from rule W2 in this case): + + Search backward from each instance of a European number until the + first strong type (R, L, AL, or sos) is found. If an AL is found, + change the type of the European number to Arabic number. + + To support this, we use a bidi iterator object, 'struct bidi_it', + which is a sub-structure of 'struct it' used by xdisp.c (see + dispextern.h for the definition of both of these structures). The + bidi iterator holds the entire state of the iteration required by + the UBA, and is updated as the text is traversed. In particular, + the embedding level of the current character being resolved is + recorded in the iterator state. To avoid costly searches backward + in support of rules like W2 above, the necessary character types + are also recorded in the iterator state as they are found during + the forward scan, and then used when such rules need to be applied. + (Forward scans cannot be avoided in this way; they need to be + performed at least once, and the results recorded in the iterator + state, to be reused until the forward scan oversteps the recorded + position.) + + In this manner, the iterator state acts as a mini-cache of + contextual information required for resolving the level of the + current character by various UBA rules. + + Caching of bidi iterator states + ------------------------------- + + As described above, the reordering engine uses the information + recorded in the bidi iterator state in order to resolve the + embedding level of the current character. When the reordering + engine needs to process the next character in the logical order, it + fetches it and applies to it all the UBA levels, updating the + iterator state as it goes. But when the buffer or string is + scanned backwards, i.e. in the reverse order of buffer/string + positions, the scanned characters were already processed during the + preceding forward scan (see bidi_find_other_level_edge). To avoid + costly re-processing of characters that were already processed + during the forward scan, the iterator states computed while + scanning forward are cached. + + The cache is just a linear array of 'struct bidi_it' objects, which + is dynamically allocated and reallocated as needed, since the size + of the cache depends on the text being processed. We only need the + cache while processing embedded levels higher than the base + paragraph embedding level, because these higher levels require + changes in scan direction. Therefore, as soon as we are back to + the base embedding level, we can free the cache; see the calls to + bidi_cache_reset and bidi_cache_shrink, for the conditions to do + this. + + The cache maintains the index of the next unused cache slot -- this + is where the next iterator state will be cached. The function + bidi_cache_iterator_state saves an instance of the state in the + cache and increments the unused slot index. The companion function + bidi_cache_find looks up a cached state that corresponds to a given + buffer/string position. All of the cached states must correspond + 1:1 to the buffer or string region whose processing they reflect; + bidi.c will abort if it finds cache slots that violate this 1:1 + correspondence. + + When the parent iterator 'struct it' is pushed (see push_it in + xdisp.c) to pause the current iteration and start iterating over a + different object (e.g., a 'display' string that covers some buffer + text), the bidi iterator cache needs to be "pushed" as well, so + that a new empty cache could be used while iterating over the new + object. Later, when the new object is exhausted, and xdisp.c calls + pop_it, we need to "pop" the bidi cache as well and return to the + original cache. See bidi_push_it and bidi_pop_it for how this is + done. + + Some functions of the display engine save copies of 'struct it' in + local variables, and restore them later. For examples, see + pos_visible_p and move_it_in_display_line_to in xdisp.c, and + window_scroll_pixel_based in window.c. When this happens, we need + to save and restore the bidi cache as well, because conceptually + the cache is part of the 'struct it' state, and needs to be in + perfect sync with the portion of the buffer/string that is being + processed. This saving and restoring of the cache state is handled + by bidi_shelve_cache and bidi_unshelve_cache, and the helper macros + SAVE_IT and RESTORE_IT defined on xdisp.c. + + Note that, because reordering is implemented below the level in + xdisp.c that breaks glyphs into screen lines, we are violating + paragraph 3.4 of UAX#9. which mandates that line breaking shall be + done before reordering each screen line separately. However, + following UAX#9 to the letter in this matter goes against the basic + design of the Emacs display engine, and so we choose here this + minor deviation from the UBA letter in preference to redesign of + the display engine. The effect of this is only seen in continued + lines that are broken into screen lines in the middle of a run + whose direction is opposite to the paragraph's base direction. + + Important design and implementation note: when the code needs to + scan far ahead, be sure to avoid such scans as much as possible + when the buffer/string doesn't contain any RTL characters. Users + of left-to-right scripts will never forgive you if you introduce + some slow-down due to bidi in situations that don't involve any + bidirectional text. See the large comment near the beginning of + bidi_resolve_neutral, for one situation where such shortcut was + necessary. */ #include <config.h> #include <stdio.h> diff --git a/src/buffer.h b/src/buffer.h index d461415e036..de117eb9c61 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -847,8 +847,8 @@ struct buffer struct region_cache *width_run_cache; struct region_cache *bidi_paragraph_cache; - /* Non-zero means don't use redisplay optimizations for - displaying this buffer. */ + /* Non-zero means disable redisplay optimizations when rebuilding the glyph + matrices (but not when redrawing). */ bool_bf prevent_redisplay_optimizations_p : 1; /* Non-zero whenever the narrowing is changed in this buffer. */ diff --git a/src/frame.h b/src/frame.h index 62dc33511b5..ff696df9eff 100644 --- a/src/frame.h +++ b/src/frame.h @@ -375,7 +375,8 @@ struct frame set this directly, use SET_FRAME_ICONIFIED instead. */ bool_bf iconified : 1; - /* True if this frame should be redrawn. */ + /* True if this frame should be fully redisplayed. Disables all + optimizations while rebuilding matrices and redrawing. */ bool_bf garbaged : 1; /* False means, if this frame has just one window, diff --git a/src/keyboard.c b/src/keyboard.c index 277d4f1047c..87a2f91a17c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1,7 +1,6 @@ /* Keyboard and mouse input; editor command loop. -Copyright (C) 1985-1989, 1993-1997, 1999-2014 Free Software Foundation, -Inc. +Copyright (C) 1985-1989, 1993-1997, 1999-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -2379,7 +2378,7 @@ read_decoded_event_from_main_queue (struct timespec *end_time, -2 means do neither. 1 means do both. */ -/* The arguments MAP is for menu prompting. MAP is a keymap. +/* The argument MAP is a keymap for menu prompting. PREV_EVENT is the previous input event, or nil if we are reading the first event of a key sequence (or not reading a key sequence). @@ -10068,7 +10067,10 @@ DEFUN ("open-dribble-file", Fopen_dribble_file, Sopen_dribble_file, 1, 1, "FOpen dribble file: ", doc: /* Start writing all keyboard characters to a dribble file called FILE. If FILE is nil, close any open dribble file. -The file will be closed when Emacs exits. */) +The file will be closed when Emacs exits. + +Be aware that this records ALL characters you type! +This may include sensitive information such as passwords. */) (Lisp_Object file) { if (dribble) diff --git a/src/lisp.h b/src/lisp.h index 03c0d99fb27..264b8832092 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1572,6 +1572,9 @@ struct Lisp_Symbol special (with `defvar' etc), and shouldn't be lexically bound. */ bool_bf declared_special : 1; + /* True if pointed to from purespace and hence can't be GC'd. */ + bool_bf pinned : 1; + /* The symbol's name, as a Lisp string. */ Lisp_Object name; diff --git a/test/ChangeLog b/test/ChangeLog index 4b1e352051b..2ef22c9a4c6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,28 @@ +2014-04-07 João Távora <joaotavora@gmail.com> + + * automated/electric-tests.el (define-electric-pair-test): Don't + overtest.. + (inhibit-in-mismatched-string-inside-ruby-comments): New test. + (inhibit-in-mismatched-string-inside-c-comments): New test. + +2014-04-07 João Távora <joaotavora@gmail.com> + + * automated/electric-tests.el (inhibit-if-strings-mismatched): + New test, change from `inhibit-only-of-next-is-mismatched'. + +2014-04-06 João Távora <joaotavora@gmail.com> + + * automated/python-tests.el (python-triple-quote-pairing): New test. + (python-syntax-after-python-backspace): New test. + +2014-04-06 João Távora <joaotavora@gmail.com> + + * automated/electric-tests.el (electric-pair-define-test-form): + More readable test docstrings. + (whitespace-skipping-for-quotes-not-ouside) + (whitespace-skipping-for-quotes-only-inside) + (whitespace-skipping-for-quotes-in-text-mode): New tests. + 2014-04-04 João Távora <joaotavora@gmail.com> * automated/electric-tests.el (define-electric-pair-test): Don't diff --git a/test/automated/electric-tests.el b/test/automated/electric-tests.el index 9f0973e16b3..bcef9cc2adb 100644 --- a/test/automated/electric-tests.el +++ b/test/automated/electric-tests.el @@ -114,8 +114,8 @@ mode extra-desc)) () - ,(format "With \"%s\", try input %c at point %d. \ -Should %s \"%s\" and point at %d" + ,(format "With |%s|, try input %c at point %d. \ +Should %s |%s| and point at %d" fixture char (1+ pos) @@ -383,6 +383,31 @@ baz\"\"" :test-in-code nil :test-in-comments t) +(define-electric-pair-test whitespace-skipping-for-quotes-not-ouside + " \" \"" "\"-----" :expected-string "\"\" \" \"" + :expected-point 2 + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + +(define-electric-pair-test whitespace-skipping-for-quotes-only-inside + " \" \"" "---\"--" :expected-string " \"\"" + :expected-point 5 + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + +(define-electric-pair-test whitespace-skipping-quotes-not-without-proper-syntax + " \" \"" "---\"--" :expected-string " \"\"\" \"" + :expected-point 5 + :modes '(text-mode) + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + ;;; Pairing arbitrary characters ;;; diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el index dc58138ced4..8fe8f71264f 100644 --- a/test/automated/python-tests.el +++ b/test/automated/python-tests.el @@ -134,6 +134,16 @@ aliqua." ;;; Font-lock and syntax +(ert-deftest python-syntax-after-python-backspace () + ;; `python-indent-dedent-line-backspace' garbles syntax + :expected-result :failed + (python-tests-with-temp-buffer + "\"\"\"" + (goto-char (point-max)) + (python-indent-dedent-line-backspace 1) + (should (string= (buffer-string) "\"\"")) + (should (null (nth 3 (syntax-ppss)))))) + ;;; Indentation @@ -2696,6 +2706,9 @@ def foo(a, b, c): (equal (symbol-value (car ccons)) (cdr ccons))))) (kill-buffer buffer))) + +;;; Electricity + (ert-deftest python-util-forward-comment-1 () (python-tests-with-temp-buffer (concat @@ -2708,6 +2721,32 @@ def foo(a, b, c): (python-util-forward-comment -1) (should (= (point) (point-min))))) +(ert-deftest python-triple-quote-pairing () + (python-tests-with-temp-buffer + "\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (string= (buffer-string) + "\"\"\"\"\"\"\n")) + (should (= (point) 4))) + (python-tests-with-temp-buffer + "\n" + (let ((last-command-event ?\")) + (dotimes (i 3) + (call-interactively 'self-insert-command))) + (should (string= (buffer-string) + "\"\"\"\"\"\"\n")) + (should (= (point) 4))) + (python-tests-with-temp-buffer + "\"\n\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (= (point) (1- (point-max)))) + (should (string= (buffer-string) + "\"\n\"\"\"\n")))) + (provide 'python-tests) diff --git a/test/indent/perl.perl b/test/indent/perl.perl index 69c1f90c807..7cb877b0a95 100755 --- a/test/indent/perl.perl +++ b/test/indent/perl.perl @@ -16,5 +16,9 @@ EOF1 bar EOF2 +print $'; # This should not start a string! + +print "hello" for /./; + $fileType_filesButNot # bug#12373? = join( '|', map { quotemeta($_).'$' } @{$fileType->{filesButNot}} ); |