1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-22 18:35:09 +00:00

Merge from emacs-24; up to 2012-05-04T19:17:01Z!monnier@iro.umontreal.ca

This commit is contained in:
Glenn Morris 2012-08-28 09:01:59 -07:00
commit eada086196
12 changed files with 243 additions and 76 deletions

View File

@ -1,3 +1,35 @@
2012-08-28 Leo Liu <sdl.web@gmail.com>
* progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to
completion-at-point. (Bug#12220)
* skeleton.el (skeleton-untabify): Change to nil (bug#12223).
* progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267).
2012-08-28 Stefan Monnier <monnier@iro.umontreal.ca>
* files.el (safe-local-eval-forms): Fix before-save-hook entry to
be buffer-local; add delete-trailing-whitespace (bug#12259).
2012-08-28 Jeremy Moore <jmoore@ieee.org> (tiny change)
* progmodes/hideif.el (hif-compress-define-list):
Fix typo. (Bug#11951)
2012-08-28 Dan Nicolaescu <dann@gnu.org>
* progmodes/hideshow.el (hs-block-end-regexp): Restore lost
buffer local setting.
* net/rcirc.el (rcirc-split-message): Fix for buffer-local
rcirc-encode-coding-system.
2012-08-28 Leo Liu <sdl.web@gmail.com>
* net/rcirc.el (rcirc-split-message): New function.
(rcirc-send-message): Use it. (Bug#12051)
2012-08-28 Juri Linkov <juri@jurta.org>
* info.el (Info-fontify-node): Hide empty lines at the end of
@ -566,6 +598,7 @@
* files.el (hack-local-variables-filter): If an eval: form is not
known to be safe, and enable-local-variables is :safe, then ignore
the form totally, as is done for non-eval forms. (Bug#12155)
This is CVE-2012-3479.
2012-08-10 Stefan Monnier <monnier@iro.umontreal.ca>

View File

@ -2837,7 +2837,8 @@ symbol and VAL is a value that is considered safe."
;; This should be here at least as long as Emacs supports write-file-hooks.
'((add-hook 'write-file-hooks 'time-stamp)
(add-hook 'write-file-functions 'time-stamp)
(add-hook 'before-save-hook 'time-stamp))
(add-hook 'before-save-hook 'time-stamp nil t)
(add-hook 'before-save-hook 'delete-trailing-whitespace nil t))
"Expressions that are considered safe in an `eval:' local variable.
Add expressions to this list if you want Emacs to evaluate them, when
they appear in an `eval' local variable specification, without first

View File

@ -802,26 +802,36 @@ With no argument or nil as argument, use the current buffer."
(defvar rcirc-max-message-length 420
"Messages longer than this value will be split.")
(defun rcirc-split-message (message)
"Split MESSAGE into chunks within `rcirc-max-message-length'."
;; `rcirc-encode-coding-system' can have buffer-local value.
(let ((encoding rcirc-encode-coding-system))
(with-temp-buffer
(insert message)
(goto-char (point-min))
(let (result)
(while (not (eobp))
(goto-char (or (byte-to-position rcirc-max-message-length)
(point-max)))
;; max message length is 512 including CRLF
(while (and (not (bobp))
(> (length (encode-coding-region
(point-min) (point) encoding t))
rcirc-max-message-length))
(forward-char -1))
(push (delete-and-extract-region (point-min) (point)) result))
(nreverse result)))))
(defun rcirc-send-message (process target message &optional noticep silent)
"Send TARGET associated with PROCESS a privmsg with text MESSAGE.
If NOTICEP is non-nil, send a notice instead of privmsg.
If SILENT is non-nil, do not print the message in any irc buffer."
;; max message length is 512 including CRLF
(let* ((response (if noticep "NOTICE" "PRIVMSG"))
(oversize (> (length message) rcirc-max-message-length))
(text (if oversize
(substring message 0 rcirc-max-message-length)
message))
(text (if (string= text "")
" "
text))
(more (if oversize
(substring message rcirc-max-message-length))))
(let ((response (if noticep "NOTICE" "PRIVMSG")))
(rcirc-get-buffer-create process target)
(rcirc-send-string process (concat response " " target " :" text))
(unless silent
(rcirc-print process (rcirc-nick process) response target text))
(when more (rcirc-send-message process target more noticep))))
(dolist (msg (rcirc-split-message message))
(rcirc-send-string process (concat response " " target " :" msg))
(unless silent
(rcirc-print process (rcirc-nick process) response target msg)))))
(defvar rcirc-input-ring nil)
(defvar rcirc-input-ring-index 0)

View File

@ -1003,7 +1003,7 @@ Return as (TOP . BOTTOM) the extent of ifdef block."
"Compress the define list ENV into a list of defined symbols only."
(let ((new-defs nil))
(dolist (def env new-defs)
(if (hif-lookup (car def)) (push (car env) new-defs)))))
(if (hif-lookup (car def)) (push (car def) new-defs)))))
(defun hide-ifdef-set-define-alist (name)
"Set the association for NAME to `hide-ifdef-env'."

View File

@ -408,6 +408,8 @@ element (using `match-beginning') before calling `hs-forward-sexp-func'.")
(defvar hs-block-end-regexp nil
"Regexp for end of block.")
(make-variable-buffer-local 'hs-block-end-regexp)
(defvar hs-forward-sexp-func 'forward-sexp
"Function used to do a `forward-sexp'.

View File

@ -202,6 +202,11 @@
(require 'comint))
(require 'executable)
(autoload 'comint-completion-at-point "comint")
(autoload 'comint-filename-completion "comint")
(autoload 'shell-command-completion "shell")
(autoload 'shell-environment-variable-completion "shell")
(defvar font-lock-comment-face)
(defvar font-lock-set-defaults)
(defvar font-lock-string-face)
@ -470,7 +475,6 @@ This is buffer-local in every such buffer.")
(define-key map "\C-\M-x" 'sh-execute-region)
(define-key map "\C-c\C-x" 'executable-interpret)
(define-key map [remap complete-tag] 'comint-dynamic-complete)
(define-key map [remap delete-backward-char]
'backward-delete-char-untabify)
(define-key map "\C-c:" 'sh-set-shell)
@ -553,9 +557,9 @@ This is buffer-local in every such buffer.")
"Value to use for `skeleton-pair-default-alist' in Shell-Script mode.")
(defcustom sh-dynamic-complete-functions
'(shell-dynamic-complete-environment-variable
shell-dynamic-complete-command
comint-dynamic-complete-filename)
'(shell-environment-variable-completion
shell-command-completion
comint-filename-completion)
"Functions for doing TAB dynamic completion."
:type '(repeat function)
:group 'sh-script)
@ -1187,7 +1191,7 @@ This value is used for the `+' and `-' symbols in an indentation variable."
:group 'sh-indentation)
(put 'sh-basic-offset 'safe-local-variable 'integerp)
(defcustom sh-indent-comment nil
(defcustom sh-indent-comment t
"How a comment line is to be indented.
nil means leave it as it is;
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."
(const :tag "Indent as a normal line." t)
(integer :menu-tag "Indent to this col (0 means first col)."
:tag "Indent to column number.") )
:version "24.3"
:group 'sh-indentation)
@ -1485,6 +1490,7 @@ with your script for an edit-interpret-debug cycle."
(set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table)
(set (make-local-variable 'comint-dynamic-complete-functions)
sh-dynamic-complete-functions)
(add-hook 'completion-at-point-functions 'comint-completion-at-point nil t)
;; we can't look if previous line ended with `\'
(set (make-local-variable 'comint-prompt-regexp) "^[ \t]*")
(set (make-local-variable 'imenu-case-fold-search) nil)
@ -4109,20 +4115,6 @@ The document is bounded by `sh-here-document-word'."
;; various other commands
(autoload 'comint-dynamic-complete "comint"
"Dynamically perform completion at point." t)
(autoload 'shell-dynamic-complete-command "shell"
"Dynamically complete the command at point." t)
(autoload 'comint-dynamic-complete-filename "comint"
"Dynamically complete the filename at point." t)
(autoload 'shell-dynamic-complete-environment-variable "shell"
"Dynamically complete the environment variable at point." t)
(defun sh-beginning-of-command ()
;; FIXME: Redefine using SMIE.
"Move point to successive beginnings of commands."

View File

@ -77,7 +77,7 @@ The variables `v1' and `v2' are still set when calling this.")
"Function for transforming a skeleton proxy's aliases' variable value.")
(defvaralias 'skeleton-filter 'skeleton-filter-function)
(defvar skeleton-untabify t
(defvar skeleton-untabify nil ; bug#12223
"When non-nil untabifies when deleting backwards with element -ARG.")
(defvar skeleton-newline-indent-rigidly nil

View File

@ -1,3 +1,12 @@
2012-08-28 Eli Zaretskii <eliz@gnu.org>
* ralloc.c (free_bloc): Don't dereference a 'heap' structure if it
is not one of the heaps we manage. (Bug#12242)
2012-08-28 Glenn Morris <rgm@gnu.org>
* eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747)
2012-08-28 Martin Rudalics <rudalics@gmx.at>
* window.c (Fset_window_configuration): Remove handling of

View File

@ -544,11 +544,10 @@ thinking of using it for any other purpose, it is quite likely that
you're making a mistake. Think: what do you want to do when the
command is called from a keyboard macro?
This function is meant for implementing advice and other
function-modifying features. Instead of using this, it is sometimes
cleaner to give your function an extra optional argument whose
`interactive' spec specifies non-nil unconditionally (\"p\" is a good
way to do this), or via (not (or executing-kbd-macro noninteractive)). */)
Instead of using this function, it is sometimes cleaner to give your
function an extra optional argument whose `interactive' spec specifies
non-nil unconditionally (\"p\" is a good way to do this), or via
\(not (or executing-kbd-macro noninteractive)). */)
(Lisp_Object kind)
{
return ((INTERACTIVE || !EQ (kind, intern ("interactive")))

View File

@ -670,6 +670,7 @@ static void
free_bloc (bloc_ptr bloc)
{
heap_ptr heap = bloc->heap;
heap_ptr h;
if (r_alloc_freeze_level)
{
@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc)
bloc->prev->next = bloc->next;
}
/* Update the records of which blocs are in HEAP. */
if (heap->first_bloc == bloc)
/* Sometimes, 'heap' obtained from bloc->heap above is not really a
'heap' structure. It can even be beyond the current break point,
which will cause crashes when we dereference it below (see
bug#12242). Evidently, the reason is bloc allocations done while
use_relocatable_buffers was non-positive, because additional
memory we get then is not recorded in the heaps we manage. If
bloc->heap records such a "heap", we cannot (and don't need to)
update its records. So we validate the 'heap' value by making
sure it is one of the heaps we manage via the heaps linked list,
and don't touch a 'heap' that isn't found there. This avoids
accessing memory we know nothing about. */
for (h = first_heap; h != NIL_HEAP; h = h->next)
if (heap == h)
break;
if (h)
{
if (bloc->next != 0 && bloc->next->heap == heap)
heap->first_bloc = bloc->next;
else
heap->first_bloc = heap->last_bloc = NIL_BLOC;
}
if (heap->last_bloc == bloc)
{
if (bloc->prev != 0 && bloc->prev->heap == heap)
heap->last_bloc = bloc->prev;
else
heap->first_bloc = heap->last_bloc = NIL_BLOC;
/* Update the records of which blocs are in HEAP. */
if (heap->first_bloc == bloc)
{
if (bloc->next != 0 && bloc->next->heap == heap)
heap->first_bloc = bloc->next;
else
heap->first_bloc = heap->last_bloc = NIL_BLOC;
}
if (heap->last_bloc == bloc)
{
if (bloc->prev != 0 && bloc->prev->heap == heap)
heap->last_bloc = bloc->prev;
else
heap->first_bloc = heap->last_bloc = NIL_BLOC;
}
}
relinquish ();

View File

@ -1,3 +1,8 @@
2012-08-28 Chong Yidong <cyd@gnu.org>
* automated/files.el: Test every combination of values for
enable-local-variables and enable-local-eval.
2012-08-19 Chong Yidong <cyd@gnu.org>
* redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.

View File

@ -21,32 +21,129 @@
(require 'ert)
(defvar files-test-var1 nil)
;; Set to t if the local variable was set, `query' if the query was
;; triggered.
(defvar files-test-result)
(defvar files-test-safe-result)
(put 'files-test-safe-result 'safe-local-variable 'booleanp)
(defun files-test-fun1 ()
(setq files-test-var1 t))
(setq files-test-result t))
(ert-deftest files-test-bug12155 ()
"Test for http://debbugs.gnu.org/12155 ."
(with-temp-buffer
(insert "text\n"
";; Local Variables:\n"
";; eval: (files-test-fun1)\n"
";; End:\n")
(let ((enable-local-variables :safe)
(enable-local-eval 'maybe))
(hack-local-variables)
(should (eq files-test-var1 nil)))))
;; Test combinations:
;; `enable-local-variables' t, nil, :safe, :all, or something else.
;; `enable-local-eval' t, nil, or something else.
(ert-deftest files-test-disable-local-variables ()
"Test that setting enable-local-variables to nil works."
(defvar files-test-local-variable-data
;; Unsafe eval form
'((("eval: (files-test-fun1)")
(t t (eq files-test-result t))
(t nil (eq files-test-result nil))
(t maybe (eq files-test-result 'query))
(nil t (eq files-test-result nil))
(nil nil (eq files-test-result nil))
(nil maybe (eq files-test-result nil))
(:safe t (eq files-test-result nil))
(:safe nil (eq files-test-result nil))
(:safe maybe (eq files-test-result nil))
(:all t (eq files-test-result t))
(:all nil (eq files-test-result nil))
(:all maybe (eq files-test-result t)) ; This combination is ambiguous.
(maybe t (eq files-test-result 'query))
(maybe nil (eq files-test-result 'query))
(maybe maybe (eq files-test-result 'query)))
;; Unsafe local variable value
(("files-test-result: t")
(t t (eq files-test-result 'query))
(t nil (eq files-test-result 'query))
(t maybe (eq files-test-result 'query))
(nil t (eq files-test-result nil))
(nil nil (eq files-test-result nil))
(nil maybe (eq files-test-result nil))
(:safe t (eq files-test-result nil))
(:safe nil (eq files-test-result nil))
(:safe maybe (eq files-test-result nil))
(:all t (eq files-test-result t))
(:all nil (eq files-test-result t))
(:all maybe (eq files-test-result t))
(maybe t (eq files-test-result 'query))
(maybe nil (eq files-test-result 'query))
(maybe maybe (eq files-test-result 'query)))
;; Safe local variable
(("files-test-safe-result: t")
(t t (eq files-test-safe-result t))
(t nil (eq files-test-safe-result t))
(t maybe (eq files-test-safe-result t))
(nil t (eq files-test-safe-result nil))
(nil nil (eq files-test-safe-result nil))
(nil maybe (eq files-test-safe-result nil))
(:safe t (eq files-test-safe-result t))
(:safe nil (eq files-test-safe-result t))
(:safe maybe (eq files-test-safe-result t))
(:all t (eq files-test-safe-result t))
(:all nil (eq files-test-safe-result t))
(:all maybe (eq files-test-safe-result t))
(maybe t (eq files-test-result 'query))
(maybe nil (eq files-test-result 'query))
(maybe maybe (eq files-test-result 'query)))
;; Safe local variable with unsafe value
(("files-test-safe-result: 1")
(t t (eq files-test-result 'query))
(t nil (eq files-test-result 'query))
(t maybe (eq files-test-result 'query))
(nil t (eq files-test-safe-result nil))
(nil nil (eq files-test-safe-result nil))
(nil maybe (eq files-test-safe-result nil))
(:safe t (eq files-test-safe-result nil))
(:safe nil (eq files-test-safe-result nil))
(:safe maybe (eq files-test-safe-result nil))
(:all t (eq files-test-safe-result 1))
(:all nil (eq files-test-safe-result 1))
(:all maybe (eq files-test-safe-result 1))
(maybe t (eq files-test-result 'query))
(maybe nil (eq files-test-result 'query))
(maybe maybe (eq files-test-result 'query))))
"List of file-local variable tests.
Each list element should have the form
(LOCAL-VARS-LIST . TEST-LIST)
where LOCAL-VARS-LISTS should be a list of local variable
definitions (strings) and TEST-LIST is a list of tests to
perform. Each entry of TEST-LIST should have the form
(ENABLE-LOCAL-VARIABLES ENABLE-LOCAL-EVAL FORM)
where ENABLE-LOCAL-VARIABLES is the value to assign to
`enable-local-variables', ENABLE-LOCAL-EVAL is the value to
assign to `enable-local-eval', and FORM is a desired `should'
form.")
(defun file-test--do-local-variables-test (str test-settings)
(with-temp-buffer
(insert "text\n"
";; Local Variables:\n"
";; files-test-var1: t\n"
";; End:\n")
(let ((enable-local-variables nil))
(insert str)
(let ((enable-local-variables (nth 0 test-settings))
(enable-local-eval (nth 1 test-settings))
(files-test-result nil)
(files-test-queried nil)
(files-test-safe-result nil))
(hack-local-variables)
(should (eq files-test-var1 nil)))))
(eval (nth 2 test-settings)))))
(ert-deftest files-test-local-variables ()
"Test the file-local variables implementation."
(unwind-protect
(progn
(defadvice hack-local-variables-confirm (around files-test activate)
(setq files-test-result 'query)
nil)
(dolist (test files-test-local-variable-data)
(let ((str (concat "text\n\n;; Local Variables:\n;; "
(mapconcat 'identity (car test) "\n;; ")
"\n;; End:\n")))
(dolist (subtest (cdr test))
(should (file-test--do-local-variables-test str subtest))))))
(ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
;;; files.el ends here