diff options
| author | Glenn Morris | 2012-08-28 09:01:59 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-08-28 09:01:59 -0700 |
| commit | eada086196ccb005ded188ac2e58d41f3682a125 (patch) | |
| tree | f195bbf91841ea4e85d465307d62c709924892c2 | |
| parent | 37b9743e79bac608a45fade0744248446aaa0a33 (diff) | |
| parent | 806f0cc7302bd1dacfad8366f67a97e9bfbc8fc9 (diff) | |
| download | emacs-eada086196ccb005ded188ac2e58d41f3682a125.tar.gz emacs-eada086196ccb005ded188ac2e58d41f3682a125.zip | |
Merge from emacs-24; up to 2012-05-04T19:17:01Z!monnier@iro.umontreal.ca
| -rw-r--r-- | lisp/ChangeLog | 33 | ||||
| -rw-r--r-- | lisp/files.el | 3 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 40 | ||||
| -rw-r--r-- | lisp/progmodes/hideif.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/hideshow.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 30 | ||||
| -rw-r--r-- | lisp/skeleton.el | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/eval.c | 9 | ||||
| -rw-r--r-- | src/ralloc.c | 45 | ||||
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/files.el | 139 |
12 files changed, 243 insertions, 76 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3dd2b7b1272..5d05f3b8f3a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2012-08-28 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to | ||
| 4 | completion-at-point. (Bug#12220) | ||
| 5 | |||
| 6 | * skeleton.el (skeleton-untabify): Change to nil (bug#12223). | ||
| 7 | |||
| 8 | * progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267). | ||
| 9 | |||
| 10 | 2012-08-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 11 | |||
| 12 | * files.el (safe-local-eval-forms): Fix before-save-hook entry to | ||
| 13 | be buffer-local; add delete-trailing-whitespace (bug#12259). | ||
| 14 | |||
| 15 | 2012-08-28 Jeremy Moore <jmoore@ieee.org> (tiny change) | ||
| 16 | |||
| 17 | * progmodes/hideif.el (hif-compress-define-list): | ||
| 18 | Fix typo. (Bug#11951) | ||
| 19 | |||
| 20 | 2012-08-28 Dan Nicolaescu <dann@gnu.org> | ||
| 21 | |||
| 22 | * progmodes/hideshow.el (hs-block-end-regexp): Restore lost | ||
| 23 | buffer local setting. | ||
| 24 | |||
| 25 | * net/rcirc.el (rcirc-split-message): Fix for buffer-local | ||
| 26 | rcirc-encode-coding-system. | ||
| 27 | |||
| 28 | 2012-08-28 Leo Liu <sdl.web@gmail.com> | ||
| 29 | |||
| 30 | * net/rcirc.el (rcirc-split-message): New function. | ||
| 31 | (rcirc-send-message): Use it. (Bug#12051) | ||
| 32 | |||
| 1 | 2012-08-28 Juri Linkov <juri@jurta.org> | 33 | 2012-08-28 Juri Linkov <juri@jurta.org> |
| 2 | 34 | ||
| 3 | * info.el (Info-fontify-node): Hide empty lines at the end of | 35 | * info.el (Info-fontify-node): Hide empty lines at the end of |
| @@ -566,6 +598,7 @@ | |||
| 566 | * files.el (hack-local-variables-filter): If an eval: form is not | 598 | * files.el (hack-local-variables-filter): If an eval: form is not |
| 567 | known to be safe, and enable-local-variables is :safe, then ignore | 599 | known to be safe, and enable-local-variables is :safe, then ignore |
| 568 | the form totally, as is done for non-eval forms. (Bug#12155) | 600 | the form totally, as is done for non-eval forms. (Bug#12155) |
| 601 | This is CVE-2012-3479. | ||
| 569 | 602 | ||
| 570 | 2012-08-10 Stefan Monnier <monnier@iro.umontreal.ca> | 603 | 2012-08-10 Stefan Monnier <monnier@iro.umontreal.ca> |
| 571 | 604 | ||
diff --git a/lisp/files.el b/lisp/files.el index 5caa4681884..fecb02020e6 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2837,7 +2837,8 @@ symbol and VAL is a value that is considered safe." | |||
| 2837 | ;; This should be here at least as long as Emacs supports write-file-hooks. | 2837 | ;; This should be here at least as long as Emacs supports write-file-hooks. |
| 2838 | '((add-hook 'write-file-hooks 'time-stamp) | 2838 | '((add-hook 'write-file-hooks 'time-stamp) |
| 2839 | (add-hook 'write-file-functions 'time-stamp) | 2839 | (add-hook 'write-file-functions 'time-stamp) |
| 2840 | (add-hook 'before-save-hook 'time-stamp)) | 2840 | (add-hook 'before-save-hook 'time-stamp nil t) |
| 2841 | (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) | ||
| 2841 | "Expressions that are considered safe in an `eval:' local variable. | 2842 | "Expressions that are considered safe in an `eval:' local variable. |
| 2842 | Add expressions to this list if you want Emacs to evaluate them, when | 2843 | Add expressions to this list if you want Emacs to evaluate them, when |
| 2843 | they appear in an `eval' local variable specification, without first | 2844 | they appear in an `eval' local variable specification, without first |
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 27cf50f06ca..dd345630b9b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -802,26 +802,36 @@ With no argument or nil as argument, use the current buffer." | |||
| 802 | (defvar rcirc-max-message-length 420 | 802 | (defvar rcirc-max-message-length 420 |
| 803 | "Messages longer than this value will be split.") | 803 | "Messages longer than this value will be split.") |
| 804 | 804 | ||
| 805 | (defun rcirc-split-message (message) | ||
| 806 | "Split MESSAGE into chunks within `rcirc-max-message-length'." | ||
| 807 | ;; `rcirc-encode-coding-system' can have buffer-local value. | ||
| 808 | (let ((encoding rcirc-encode-coding-system)) | ||
| 809 | (with-temp-buffer | ||
| 810 | (insert message) | ||
| 811 | (goto-char (point-min)) | ||
| 812 | (let (result) | ||
| 813 | (while (not (eobp)) | ||
| 814 | (goto-char (or (byte-to-position rcirc-max-message-length) | ||
| 815 | (point-max))) | ||
| 816 | ;; max message length is 512 including CRLF | ||
| 817 | (while (and (not (bobp)) | ||
| 818 | (> (length (encode-coding-region | ||
| 819 | (point-min) (point) encoding t)) | ||
| 820 | rcirc-max-message-length)) | ||
| 821 | (forward-char -1)) | ||
| 822 | (push (delete-and-extract-region (point-min) (point)) result)) | ||
| 823 | (nreverse result))))) | ||
| 824 | |||
| 805 | (defun rcirc-send-message (process target message &optional noticep silent) | 825 | (defun rcirc-send-message (process target message &optional noticep silent) |
| 806 | "Send TARGET associated with PROCESS a privmsg with text MESSAGE. | 826 | "Send TARGET associated with PROCESS a privmsg with text MESSAGE. |
| 807 | If NOTICEP is non-nil, send a notice instead of privmsg. | 827 | If NOTICEP is non-nil, send a notice instead of privmsg. |
| 808 | If SILENT is non-nil, do not print the message in any irc buffer." | 828 | If SILENT is non-nil, do not print the message in any irc buffer." |
| 809 | ;; max message length is 512 including CRLF | 829 | (let ((response (if noticep "NOTICE" "PRIVMSG"))) |
| 810 | (let* ((response (if noticep "NOTICE" "PRIVMSG")) | ||
| 811 | (oversize (> (length message) rcirc-max-message-length)) | ||
| 812 | (text (if oversize | ||
| 813 | (substring message 0 rcirc-max-message-length) | ||
| 814 | message)) | ||
| 815 | (text (if (string= text "") | ||
| 816 | " " | ||
| 817 | text)) | ||
| 818 | (more (if oversize | ||
| 819 | (substring message rcirc-max-message-length)))) | ||
| 820 | (rcirc-get-buffer-create process target) | 830 | (rcirc-get-buffer-create process target) |
| 821 | (rcirc-send-string process (concat response " " target " :" text)) | 831 | (dolist (msg (rcirc-split-message message)) |
| 822 | (unless silent | 832 | (rcirc-send-string process (concat response " " target " :" msg)) |
| 823 | (rcirc-print process (rcirc-nick process) response target text)) | 833 | (unless silent |
| 824 | (when more (rcirc-send-message process target more noticep)))) | 834 | (rcirc-print process (rcirc-nick process) response target msg))))) |
| 825 | 835 | ||
| 826 | (defvar rcirc-input-ring nil) | 836 | (defvar rcirc-input-ring nil) |
| 827 | (defvar rcirc-input-ring-index 0) | 837 | (defvar rcirc-input-ring-index 0) |
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 3e3d7adc0b6..4b77c6dab1a 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el | |||
| @@ -1003,7 +1003,7 @@ Return as (TOP . BOTTOM) the extent of ifdef block." | |||
| 1003 | "Compress the define list ENV into a list of defined symbols only." | 1003 | "Compress the define list ENV into a list of defined symbols only." |
| 1004 | (let ((new-defs nil)) | 1004 | (let ((new-defs nil)) |
| 1005 | (dolist (def env new-defs) | 1005 | (dolist (def env new-defs) |
| 1006 | (if (hif-lookup (car def)) (push (car env) new-defs))))) | 1006 | (if (hif-lookup (car def)) (push (car def) new-defs))))) |
| 1007 | 1007 | ||
| 1008 | (defun hide-ifdef-set-define-alist (name) | 1008 | (defun hide-ifdef-set-define-alist (name) |
| 1009 | "Set the association for NAME to `hide-ifdef-env'." | 1009 | "Set the association for NAME to `hide-ifdef-env'." |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index b6d2b5e319c..233b9a5212e 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -408,6 +408,8 @@ element (using `match-beginning') before calling `hs-forward-sexp-func'.") | |||
| 408 | 408 | ||
| 409 | (defvar hs-block-end-regexp nil | 409 | (defvar hs-block-end-regexp nil |
| 410 | "Regexp for end of block.") | 410 | "Regexp for end of block.") |
| 411 | (make-variable-buffer-local 'hs-block-end-regexp) | ||
| 412 | |||
| 411 | 413 | ||
| 412 | (defvar hs-forward-sexp-func 'forward-sexp | 414 | (defvar hs-forward-sexp-func 'forward-sexp |
| 413 | "Function used to do a `forward-sexp'. | 415 | "Function used to do a `forward-sexp'. |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a6089aabb04..a422462775d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -202,6 +202,11 @@ | |||
| 202 | (require 'comint)) | 202 | (require 'comint)) |
| 203 | (require 'executable) | 203 | (require 'executable) |
| 204 | 204 | ||
| 205 | (autoload 'comint-completion-at-point "comint") | ||
| 206 | (autoload 'comint-filename-completion "comint") | ||
| 207 | (autoload 'shell-command-completion "shell") | ||
| 208 | (autoload 'shell-environment-variable-completion "shell") | ||
| 209 | |||
| 205 | (defvar font-lock-comment-face) | 210 | (defvar font-lock-comment-face) |
| 206 | (defvar font-lock-set-defaults) | 211 | (defvar font-lock-set-defaults) |
| 207 | (defvar font-lock-string-face) | 212 | (defvar font-lock-string-face) |
| @@ -470,7 +475,6 @@ This is buffer-local in every such buffer.") | |||
| 470 | (define-key map "\C-\M-x" 'sh-execute-region) | 475 | (define-key map "\C-\M-x" 'sh-execute-region) |
| 471 | (define-key map "\C-c\C-x" 'executable-interpret) | 476 | (define-key map "\C-c\C-x" 'executable-interpret) |
| 472 | 477 | ||
| 473 | (define-key map [remap complete-tag] 'comint-dynamic-complete) | ||
| 474 | (define-key map [remap delete-backward-char] | 478 | (define-key map [remap delete-backward-char] |
| 475 | 'backward-delete-char-untabify) | 479 | 'backward-delete-char-untabify) |
| 476 | (define-key map "\C-c:" 'sh-set-shell) | 480 | (define-key map "\C-c:" 'sh-set-shell) |
| @@ -553,9 +557,9 @@ This is buffer-local in every such buffer.") | |||
| 553 | "Value to use for `skeleton-pair-default-alist' in Shell-Script mode.") | 557 | "Value to use for `skeleton-pair-default-alist' in Shell-Script mode.") |
| 554 | 558 | ||
| 555 | (defcustom sh-dynamic-complete-functions | 559 | (defcustom sh-dynamic-complete-functions |
| 556 | '(shell-dynamic-complete-environment-variable | 560 | '(shell-environment-variable-completion |
| 557 | shell-dynamic-complete-command | 561 | shell-command-completion |
| 558 | comint-dynamic-complete-filename) | 562 | comint-filename-completion) |
| 559 | "Functions for doing TAB dynamic completion." | 563 | "Functions for doing TAB dynamic completion." |
| 560 | :type '(repeat function) | 564 | :type '(repeat function) |
| 561 | :group 'sh-script) | 565 | :group 'sh-script) |
| @@ -1187,7 +1191,7 @@ This value is used for the `+' and `-' symbols in an indentation variable." | |||
| 1187 | :group 'sh-indentation) | 1191 | :group 'sh-indentation) |
| 1188 | (put 'sh-basic-offset 'safe-local-variable 'integerp) | 1192 | (put 'sh-basic-offset 'safe-local-variable 'integerp) |
| 1189 | 1193 | ||
| 1190 | (defcustom sh-indent-comment nil | 1194 | (defcustom sh-indent-comment t |
| 1191 | "How a comment line is to be indented. | 1195 | "How a comment line is to be indented. |
| 1192 | nil means leave it as it is; | 1196 | nil means leave it as it is; |
| 1193 | t means indent it as a normal line, aligning it to previous non-blank | 1197 | t means indent it as a normal line, aligning it to previous non-blank |
| @@ -1198,6 +1202,7 @@ a number means align to that column, e.g. 0 means first column." | |||
| 1198 | (const :tag "Indent as a normal line." t) | 1202 | (const :tag "Indent as a normal line." t) |
| 1199 | (integer :menu-tag "Indent to this col (0 means first col)." | 1203 | (integer :menu-tag "Indent to this col (0 means first col)." |
| 1200 | :tag "Indent to column number.") ) | 1204 | :tag "Indent to column number.") ) |
| 1205 | :version "24.3" | ||
| 1201 | :group 'sh-indentation) | 1206 | :group 'sh-indentation) |
| 1202 | 1207 | ||
| 1203 | 1208 | ||
| @@ -1485,6 +1490,7 @@ with your script for an edit-interpret-debug cycle." | |||
| 1485 | (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table) | 1490 | (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table) |
| 1486 | (set (make-local-variable 'comint-dynamic-complete-functions) | 1491 | (set (make-local-variable 'comint-dynamic-complete-functions) |
| 1487 | sh-dynamic-complete-functions) | 1492 | sh-dynamic-complete-functions) |
| 1493 | (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t) | ||
| 1488 | ;; we can't look if previous line ended with `\' | 1494 | ;; we can't look if previous line ended with `\' |
| 1489 | (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*") | 1495 | (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*") |
| 1490 | (set (make-local-variable 'imenu-case-fold-search) nil) | 1496 | (set (make-local-variable 'imenu-case-fold-search) nil) |
| @@ -4109,20 +4115,6 @@ The document is bounded by `sh-here-document-word'." | |||
| 4109 | 4115 | ||
| 4110 | ;; various other commands | 4116 | ;; various other commands |
| 4111 | 4117 | ||
| 4112 | (autoload 'comint-dynamic-complete "comint" | ||
| 4113 | "Dynamically perform completion at point." t) | ||
| 4114 | |||
| 4115 | (autoload 'shell-dynamic-complete-command "shell" | ||
| 4116 | "Dynamically complete the command at point." t) | ||
| 4117 | |||
| 4118 | (autoload 'comint-dynamic-complete-filename "comint" | ||
| 4119 | "Dynamically complete the filename at point." t) | ||
| 4120 | |||
| 4121 | (autoload 'shell-dynamic-complete-environment-variable "shell" | ||
| 4122 | "Dynamically complete the environment variable at point." t) | ||
| 4123 | |||
| 4124 | |||
| 4125 | |||
| 4126 | (defun sh-beginning-of-command () | 4118 | (defun sh-beginning-of-command () |
| 4127 | ;; FIXME: Redefine using SMIE. | 4119 | ;; FIXME: Redefine using SMIE. |
| 4128 | "Move point to successive beginnings of commands." | 4120 | "Move point to successive beginnings of commands." |
diff --git a/lisp/skeleton.el b/lisp/skeleton.el index 34d69a74369..b6e1d0a58f2 100644 --- a/lisp/skeleton.el +++ b/lisp/skeleton.el | |||
| @@ -77,7 +77,7 @@ The variables `v1' and `v2' are still set when calling this.") | |||
| 77 | "Function for transforming a skeleton proxy's aliases' variable value.") | 77 | "Function for transforming a skeleton proxy's aliases' variable value.") |
| 78 | (defvaralias 'skeleton-filter 'skeleton-filter-function) | 78 | (defvaralias 'skeleton-filter 'skeleton-filter-function) |
| 79 | 79 | ||
| 80 | (defvar skeleton-untabify t | 80 | (defvar skeleton-untabify nil ; bug#12223 |
| 81 | "When non-nil untabifies when deleting backwards with element -ARG.") | 81 | "When non-nil untabifies when deleting backwards with element -ARG.") |
| 82 | 82 | ||
| 83 | (defvar skeleton-newline-indent-rigidly nil | 83 | (defvar skeleton-newline-indent-rigidly nil |
diff --git a/src/ChangeLog b/src/ChangeLog index 2521ddc4144..5bafa1a04f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-08-28 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it | ||
| 4 | is not one of the heaps we manage. (Bug#12242) | ||
| 5 | |||
| 6 | 2012-08-28 Glenn Morris <rgm@gnu.org> | ||
| 7 | |||
| 8 | * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747) | ||
| 9 | |||
| 1 | 2012-08-28 Martin Rudalics <rudalics@gmx.at> | 10 | 2012-08-28 Martin Rudalics <rudalics@gmx.at> |
| 2 | 11 | ||
| 3 | * window.c (Fset_window_configuration): Remove handling of | 12 | * window.c (Fset_window_configuration): Remove handling of |
diff --git a/src/eval.c b/src/eval.c index df44c87dc25..c56be10c5a0 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -544,11 +544,10 @@ thinking of using it for any other purpose, it is quite likely that | |||
| 544 | you're making a mistake. Think: what do you want to do when the | 544 | you're making a mistake. Think: what do you want to do when the |
| 545 | command is called from a keyboard macro? | 545 | command is called from a keyboard macro? |
| 546 | 546 | ||
| 547 | This function is meant for implementing advice and other | 547 | Instead of using this function, it is sometimes cleaner to give your |
| 548 | function-modifying features. Instead of using this, it is sometimes | 548 | function an extra optional argument whose `interactive' spec specifies |
| 549 | cleaner to give your function an extra optional argument whose | 549 | non-nil unconditionally (\"p\" is a good way to do this), or via |
| 550 | `interactive' spec specifies non-nil unconditionally (\"p\" is a good | 550 | \(not (or executing-kbd-macro noninteractive)). */) |
| 551 | way to do this), or via (not (or executing-kbd-macro noninteractive)). */) | ||
| 552 | (Lisp_Object kind) | 551 | (Lisp_Object kind) |
| 553 | { | 552 | { |
| 554 | return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) | 553 | return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) |
diff --git a/src/ralloc.c b/src/ralloc.c index c40258693f5..3877e21d4f6 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -670,6 +670,7 @@ static void | |||
| 670 | free_bloc (bloc_ptr bloc) | 670 | free_bloc (bloc_ptr bloc) |
| 671 | { | 671 | { |
| 672 | heap_ptr heap = bloc->heap; | 672 | heap_ptr heap = bloc->heap; |
| 673 | heap_ptr h; | ||
| 673 | 674 | ||
| 674 | if (r_alloc_freeze_level) | 675 | if (r_alloc_freeze_level) |
| 675 | { | 676 | { |
| @@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc) | |||
| 699 | bloc->prev->next = bloc->next; | 700 | bloc->prev->next = bloc->next; |
| 700 | } | 701 | } |
| 701 | 702 | ||
| 702 | /* Update the records of which blocs are in HEAP. */ | 703 | /* Sometimes, 'heap' obtained from bloc->heap above is not really a |
| 703 | if (heap->first_bloc == bloc) | 704 | 'heap' structure. It can even be beyond the current break point, |
| 705 | which will cause crashes when we dereference it below (see | ||
| 706 | bug#12242). Evidently, the reason is bloc allocations done while | ||
| 707 | use_relocatable_buffers was non-positive, because additional | ||
| 708 | memory we get then is not recorded in the heaps we manage. If | ||
| 709 | bloc->heap records such a "heap", we cannot (and don't need to) | ||
| 710 | update its records. So we validate the 'heap' value by making | ||
| 711 | sure it is one of the heaps we manage via the heaps linked list, | ||
| 712 | and don't touch a 'heap' that isn't found there. This avoids | ||
| 713 | accessing memory we know nothing about. */ | ||
| 714 | for (h = first_heap; h != NIL_HEAP; h = h->next) | ||
| 715 | if (heap == h) | ||
| 716 | break; | ||
| 717 | |||
| 718 | if (h) | ||
| 704 | { | 719 | { |
| 705 | if (bloc->next != 0 && bloc->next->heap == heap) | 720 | /* Update the records of which blocs are in HEAP. */ |
| 706 | heap->first_bloc = bloc->next; | 721 | if (heap->first_bloc == bloc) |
| 707 | else | 722 | { |
| 708 | heap->first_bloc = heap->last_bloc = NIL_BLOC; | 723 | if (bloc->next != 0 && bloc->next->heap == heap) |
| 709 | } | 724 | heap->first_bloc = bloc->next; |
| 710 | if (heap->last_bloc == bloc) | 725 | else |
| 711 | { | 726 | heap->first_bloc = heap->last_bloc = NIL_BLOC; |
| 712 | if (bloc->prev != 0 && bloc->prev->heap == heap) | 727 | } |
| 713 | heap->last_bloc = bloc->prev; | 728 | if (heap->last_bloc == bloc) |
| 714 | else | 729 | { |
| 715 | heap->first_bloc = heap->last_bloc = NIL_BLOC; | 730 | if (bloc->prev != 0 && bloc->prev->heap == heap) |
| 731 | heap->last_bloc = bloc->prev; | ||
| 732 | else | ||
| 733 | heap->first_bloc = heap->last_bloc = NIL_BLOC; | ||
| 734 | } | ||
| 716 | } | 735 | } |
| 717 | 736 | ||
| 718 | relinquish (); | 737 | relinquish (); |
diff --git a/test/ChangeLog b/test/ChangeLog index c3183406ea2..f523f6f59a9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-08-28 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * automated/files.el: Test every combination of values for | ||
| 4 | enable-local-variables and enable-local-eval. | ||
| 5 | |||
| 1 | 2012-08-19 Chong Yidong <cyd@gnu.org> | 6 | 2012-08-19 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer. | 8 | * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer. |
diff --git a/test/automated/files.el b/test/automated/files.el index e43d8c32f85..b6011395bfd 100644 --- a/test/automated/files.el +++ b/test/automated/files.el | |||
| @@ -21,32 +21,129 @@ | |||
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | 23 | ||
| 24 | (defvar files-test-var1 nil) | 24 | ;; Set to t if the local variable was set, `query' if the query was |
| 25 | ;; triggered. | ||
| 26 | (defvar files-test-result) | ||
| 27 | |||
| 28 | (defvar files-test-safe-result) | ||
| 29 | (put 'files-test-safe-result 'safe-local-variable 'booleanp) | ||
| 25 | 30 | ||
| 26 | (defun files-test-fun1 () | 31 | (defun files-test-fun1 () |
| 27 | (setq files-test-var1 t)) | 32 | (setq files-test-result t)) |
| 28 | 33 | ||
| 29 | (ert-deftest files-test-bug12155 () | 34 | ;; Test combinations: |
| 30 | "Test for http://debbugs.gnu.org/12155 ." | 35 | ;; `enable-local-variables' t, nil, :safe, :all, or something else. |
| 31 | (with-temp-buffer | 36 | ;; `enable-local-eval' t, nil, or something else. |
| 32 | (insert "text\n" | 37 | |
| 33 | ";; Local Variables:\n" | 38 | (defvar files-test-local-variable-data |
| 34 | ";; eval: (files-test-fun1)\n" | 39 | ;; Unsafe eval form |
| 35 | ";; End:\n") | 40 | '((("eval: (files-test-fun1)") |
| 36 | (let ((enable-local-variables :safe) | 41 | (t t (eq files-test-result t)) |
| 37 | (enable-local-eval 'maybe)) | 42 | (t nil (eq files-test-result nil)) |
| 38 | (hack-local-variables) | 43 | (t maybe (eq files-test-result 'query)) |
| 39 | (should (eq files-test-var1 nil))))) | 44 | (nil t (eq files-test-result nil)) |
| 45 | (nil nil (eq files-test-result nil)) | ||
| 46 | (nil maybe (eq files-test-result nil)) | ||
| 47 | (:safe t (eq files-test-result nil)) | ||
| 48 | (:safe nil (eq files-test-result nil)) | ||
| 49 | (:safe maybe (eq files-test-result nil)) | ||
| 50 | (:all t (eq files-test-result t)) | ||
| 51 | (:all nil (eq files-test-result nil)) | ||
| 52 | (:all maybe (eq files-test-result t)) ; This combination is ambiguous. | ||
| 53 | (maybe t (eq files-test-result 'query)) | ||
| 54 | (maybe nil (eq files-test-result 'query)) | ||
| 55 | (maybe maybe (eq files-test-result 'query))) | ||
| 56 | ;; Unsafe local variable value | ||
| 57 | (("files-test-result: t") | ||
| 58 | (t t (eq files-test-result 'query)) | ||
| 59 | (t nil (eq files-test-result 'query)) | ||
| 60 | (t maybe (eq files-test-result 'query)) | ||
| 61 | (nil t (eq files-test-result nil)) | ||
| 62 | (nil nil (eq files-test-result nil)) | ||
| 63 | (nil maybe (eq files-test-result nil)) | ||
| 64 | (:safe t (eq files-test-result nil)) | ||
| 65 | (:safe nil (eq files-test-result nil)) | ||
| 66 | (:safe maybe (eq files-test-result nil)) | ||
| 67 | (:all t (eq files-test-result t)) | ||
| 68 | (:all nil (eq files-test-result t)) | ||
| 69 | (:all maybe (eq files-test-result t)) | ||
| 70 | (maybe t (eq files-test-result 'query)) | ||
| 71 | (maybe nil (eq files-test-result 'query)) | ||
| 72 | (maybe maybe (eq files-test-result 'query))) | ||
| 73 | ;; Safe local variable | ||
| 74 | (("files-test-safe-result: t") | ||
| 75 | (t t (eq files-test-safe-result t)) | ||
| 76 | (t nil (eq files-test-safe-result t)) | ||
| 77 | (t maybe (eq files-test-safe-result t)) | ||
| 78 | (nil t (eq files-test-safe-result nil)) | ||
| 79 | (nil nil (eq files-test-safe-result nil)) | ||
| 80 | (nil maybe (eq files-test-safe-result nil)) | ||
| 81 | (:safe t (eq files-test-safe-result t)) | ||
| 82 | (:safe nil (eq files-test-safe-result t)) | ||
| 83 | (:safe maybe (eq files-test-safe-result t)) | ||
| 84 | (:all t (eq files-test-safe-result t)) | ||
| 85 | (:all nil (eq files-test-safe-result t)) | ||
| 86 | (:all maybe (eq files-test-safe-result t)) | ||
| 87 | (maybe t (eq files-test-result 'query)) | ||
| 88 | (maybe nil (eq files-test-result 'query)) | ||
| 89 | (maybe maybe (eq files-test-result 'query))) | ||
| 90 | ;; Safe local variable with unsafe value | ||
| 91 | (("files-test-safe-result: 1") | ||
| 92 | (t t (eq files-test-result 'query)) | ||
| 93 | (t nil (eq files-test-result 'query)) | ||
| 94 | (t maybe (eq files-test-result 'query)) | ||
| 95 | (nil t (eq files-test-safe-result nil)) | ||
| 96 | (nil nil (eq files-test-safe-result nil)) | ||
| 97 | (nil maybe (eq files-test-safe-result nil)) | ||
| 98 | (:safe t (eq files-test-safe-result nil)) | ||
| 99 | (:safe nil (eq files-test-safe-result nil)) | ||
| 100 | (:safe maybe (eq files-test-safe-result nil)) | ||
| 101 | (:all t (eq files-test-safe-result 1)) | ||
| 102 | (:all nil (eq files-test-safe-result 1)) | ||
| 103 | (:all maybe (eq files-test-safe-result 1)) | ||
| 104 | (maybe t (eq files-test-result 'query)) | ||
| 105 | (maybe nil (eq files-test-result 'query)) | ||
| 106 | (maybe maybe (eq files-test-result 'query)))) | ||
| 107 | "List of file-local variable tests. | ||
| 108 | Each list element should have the form | ||
| 109 | |||
| 110 | (LOCAL-VARS-LIST . TEST-LIST) | ||
| 40 | 111 | ||
| 41 | (ert-deftest files-test-disable-local-variables () | 112 | where LOCAL-VARS-LISTS should be a list of local variable |
| 42 | "Test that setting enable-local-variables to nil works." | 113 | definitions (strings) and TEST-LIST is a list of tests to |
| 114 | perform. Each entry of TEST-LIST should have the form | ||
| 115 | |||
| 116 | (ENABLE-LOCAL-VARIABLES ENABLE-LOCAL-EVAL FORM) | ||
| 117 | |||
| 118 | where ENABLE-LOCAL-VARIABLES is the value to assign to | ||
| 119 | `enable-local-variables', ENABLE-LOCAL-EVAL is the value to | ||
| 120 | assign to `enable-local-eval', and FORM is a desired `should' | ||
| 121 | form.") | ||
| 122 | |||
| 123 | (defun file-test--do-local-variables-test (str test-settings) | ||
| 43 | (with-temp-buffer | 124 | (with-temp-buffer |
| 44 | (insert "text\n" | 125 | (insert str) |
| 45 | ";; Local Variables:\n" | 126 | (let ((enable-local-variables (nth 0 test-settings)) |
| 46 | ";; files-test-var1: t\n" | 127 | (enable-local-eval (nth 1 test-settings)) |
| 47 | ";; End:\n") | 128 | (files-test-result nil) |
| 48 | (let ((enable-local-variables nil)) | 129 | (files-test-queried nil) |
| 130 | (files-test-safe-result nil)) | ||
| 49 | (hack-local-variables) | 131 | (hack-local-variables) |
| 50 | (should (eq files-test-var1 nil))))) | 132 | (eval (nth 2 test-settings))))) |
| 133 | |||
| 134 | (ert-deftest files-test-local-variables () | ||
| 135 | "Test the file-local variables implementation." | ||
| 136 | (unwind-protect | ||
| 137 | (progn | ||
| 138 | (defadvice hack-local-variables-confirm (around files-test activate) | ||
| 139 | (setq files-test-result 'query) | ||
| 140 | nil) | ||
| 141 | (dolist (test files-test-local-variable-data) | ||
| 142 | (let ((str (concat "text\n\n;; Local Variables:\n;; " | ||
| 143 | (mapconcat 'identity (car test) "\n;; ") | ||
| 144 | "\n;; End:\n"))) | ||
| 145 | (dolist (subtest (cdr test)) | ||
| 146 | (should (file-test--do-local-variables-test str subtest)))))) | ||
| 147 | (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test))) | ||
| 51 | 148 | ||
| 52 | ;;; files.el ends here | 149 | ;;; files.el ends here |