diff options
author | Karoly Lorentey <karoly@lorentey.hu> | 2007-04-22 12:42:47 +0000 |
---|---|---|
committer | Karoly Lorentey <karoly@lorentey.hu> | 2007-04-22 12:42:47 +0000 |
commit | 9d0799072a0d09bc14a99eaf372b262d1ba61399 (patch) | |
tree | 76acd4ae0559776a5ec27fbd5c25598285ec71d1 /lisp/emacs-lisp | |
parent | e18c709364b095ea0be8ecabe458ac9a642a252f (diff) | |
parent | a20becf321f023c6dc1831595712576d64e2ef4b (diff) | |
download | emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-674
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-675
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-676
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-677
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-678
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-679
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-680
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-681
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-682
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-683
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-684
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-685
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-686
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-687
Release ERC 5.2.
* emacs@sv.gnu.org/emacs--devo--0--patch-688
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-689
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-690
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-691
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-692
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-693
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-694
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-695
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-696
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-697
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-698
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-699
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-700
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-701
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-209
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-210
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-211
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-212
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-213
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-214
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-215
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-601
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/authors.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 81 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 33 | ||||
-rw-r--r-- | lisp/emacs-lisp/edebug.el | 49 | ||||
-rw-r--r-- | lisp/emacs-lisp/ewoc.el | 9 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/sregex.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/testcover.el | 12 | ||||
-rw-r--r-- | lisp/emacs-lisp/timer.el | 17 | ||||
-rw-r--r-- | lisp/emacs-lisp/warnings.el | 13 |
11 files changed, 127 insertions, 97 deletions
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index d93d80e0c8e..31464269567 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el @@ -688,5 +688,7 @@ the Emacs source tree, from which to build the file." (authors root) (write-file file))) +(provide 'authors) + ;;; arch-tag: 659d5900-5ff2-43b0-954c-a315cc1e4dc1 ;;; authors.el ends here diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index dd7e042499c..2c9dc8e3314 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -545,8 +545,8 @@ (eq (car-safe (nth 2 last)) 'cdr) (eq (cadr (nth 2 last)) var)))) (progn - (byte-compile-warn "value returned by `%s' is not used" - (prin1-to-string (car form))) + (byte-compile-warn "value returned from %s is unused" + (prin1-to-string form)) nil))) (byte-compile-log " %s called for effect; deleted" fn) ;; appending a nil here might not be necessary, but it can't hurt. @@ -557,8 +557,20 @@ ;; Otherwise, no args can be considered to be for-effect, ;; even if the called function is for-effect, because we ;; don't know anything about that function. - (cons fn (mapcar 'byte-optimize-form (cdr form))))))) - + (let ((args (mapcar #'byte-optimize-form (cdr form)))) + (if (and (get fn 'pure) + (byte-optimize-all-constp args)) + (list 'quote (apply fn (mapcar #'eval args))) + (cons fn args))))))) + +(defun byte-optimize-all-constp (list) + "Non-nil iff all elements of LIST satisfy `byte-compile-constp'." + (let ((constant t)) + (while (and list constant) + (unless (byte-compile-constp (car list)) + (setq constant nil)) + (setq list (cdr list))) + constant)) (defun byte-optimize-form (form &optional for-effect) "The source-level pass of the optimizer." @@ -1117,55 +1129,6 @@ (byte-optimize-predicate form)) form)) -(put 'concat 'byte-optimizer 'byte-optimize-pure-func) -(put 'symbol-name 'byte-optimizer 'byte-optimize-pure-func) -(put 'regexp-opt 'byte-optimizer 'byte-optimize-pure-func) -(put 'regexp-quote 'byte-optimizer 'byte-optimize-pure-func) -(put 'string-to-syntax 'byte-optimizer 'byte-optimize-pure-func) -(defun byte-optimize-pure-func (form) - "Do constant folding for pure functions. -This assumes that the function will not have any side-effects and that -its return value depends solely on its arguments. -If the function can signal an error, this might change the semantics -of FORM by signaling the error at compile-time." - (let ((args (cdr form)) - (constant t)) - (while (and args constant) - (or (byte-compile-constp (car args)) - (setq constant nil)) - (setq args (cdr args))) - (if constant - (list 'quote (eval form)) - form))) - -;; Avoid having to write forward-... with a negative arg for speed. -;; Fixme: don't be limited to constant args. -(put 'backward-char 'byte-optimizer 'byte-optimize-backward-char) -(defun byte-optimize-backward-char (form) - (cond ((and (= 2 (safe-length form)) - (numberp (nth 1 form))) - (list 'forward-char (eval (- (nth 1 form))))) - ((= 1 (safe-length form)) - '(forward-char -1)) - (t form))) - -(put 'backward-word 'byte-optimizer 'byte-optimize-backward-word) -(defun byte-optimize-backward-word (form) - (cond ((and (= 2 (safe-length form)) - (numberp (nth 1 form))) - (list 'forward-word (eval (- (nth 1 form))))) - ((= 1 (safe-length form)) - '(forward-word -1)) - (t form))) - -(put 'char-before 'byte-optimizer 'byte-optimize-char-before) -(defun byte-optimize-char-before (form) - (cond ((= 2 (safe-length form)) - `(char-after (1- ,(nth 1 form)))) - ((= 1 (safe-length form)) - '(char-after (1- (point)))) - (t form))) - ;; Fixme: delete-char -> delete-region (byte-coded) ;; optimize string-as-unibyte, string-as-multibyte, string-make-unibyte, ;; string-make-multibyte for constant args. @@ -1290,6 +1253,18 @@ of FORM by signaling the error at compile-time." (setq side-effect-and-error-free-fns (cdr side-effect-and-error-free-fns))) nil) + +;; pure functions are side-effect free functions whose values depend +;; only on their arguments. For these functions, calls with constant +;; arguments can be evaluated at compile time. This may shift run time +;; errors to compile time. + +(let ((pure-fns + '(concat symbol-name regexp-opt regexp-quote string-to-syntax))) + (while pure-fns + (put (car pure-fns) 'pure t) + (setq pure-fns (cdr pure-fns))) + nil) (defun byte-compile-splice-in-already-compiled-code (form) ;; form is (byte-code "..." [...] n) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f74e48c4635..f1761c125ac 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2341,7 +2341,7 @@ list that represents a doc string reference. (eq (car (car (cdr tail))) 'declare)) (let ((declaration (car (cdr tail)))) (setcdr tail (cdr (cdr tail))) - (princ `(if macro-declaration-function + (prin1 `(if macro-declaration-function (funcall macro-declaration-function ',name ',declaration)) outbuffer))))) @@ -3148,6 +3148,9 @@ That command is designed for interactive use only" fn)) ;; more complicated compiler macros +(byte-defop-compiler char-before) +(byte-defop-compiler backward-char) +(byte-defop-compiler backward-word) (byte-defop-compiler list) (byte-defop-compiler concat) (byte-defop-compiler fset) @@ -3159,6 +3162,34 @@ That command is designed for interactive use only" fn)) (byte-defop-compiler19 (/ byte-quo) byte-compile-quo) (byte-defop-compiler19 nconc) +(defun byte-compile-char-before (form) + (cond ((= 2 (length form)) + (byte-compile-form (list 'char-after (if (numberp (nth 1 form)) + (1- (nth 1 form)) + `(1- ,(nth 1 form)))))) + ((= 1 (length form)) + (byte-compile-form '(char-after (1- (point))))) + (t (byte-compile-subr-wrong-args form "0-1")))) + +;; backward-... ==> forward-... with negated argument. +(defun byte-compile-backward-char (form) + (cond ((= 2 (length form)) + (byte-compile-form (list 'forward-char (if (numberp (nth 1 form)) + (- (nth 1 form)) + `(- ,(nth 1 form)))))) + ((= 1 (length form)) + (byte-compile-form '(forward-char -1))) + (t (byte-compile-subr-wrong-args form "0-1")))) + +(defun byte-compile-backward-word (form) + (cond ((= 2 (length form)) + (byte-compile-form (list 'forward-word (if (numberp (nth 1 form)) + (- (nth 1 form)) + `(- ,(nth 1 form)))))) + ((= 1 (length form)) + (byte-compile-form '(forward-word -1))) + (t (byte-compile-subr-wrong-args form "0-1")))) + (defun byte-compile-list (form) (let ((count (length (cdr form)))) (cond ((= count 0) diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 2777ea775e9..9ae33599f09 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -364,31 +364,39 @@ Return the result of the last expression in BODY." (defun edebug-pop-to-buffer (buffer &optional window) ;; Like pop-to-buffer, but select window where BUFFER was last shown. - ;; Select WINDOW if it provided and it still exists. Otherwise, + ;; Select WINDOW if it is provided and still exists. Otherwise, ;; if buffer is currently shown in several windows, choose one. ;; Otherwise, find a new window, possibly splitting one. - (setq window (if (and (windowp window) (edebug-window-live-p window) - (eq (window-buffer window) buffer)) - window - (if (eq (window-buffer (selected-window)) buffer) - (selected-window) - (edebug-get-buffer-window buffer)))) - (if window - (select-window window) - (if (one-window-p) - (split-window)) - ;; (message "next window: %s" (next-window)) (sit-for 1) - (if (eq (get-buffer-window edebug-trace-buffer) (next-window)) - ;; Don't select trace window - nil - (select-window (next-window)))) - (set-window-buffer (selected-window) buffer) - (set-window-hscroll (selected-window) 0);; should this be?? + (setq window + (cond + ((and (windowp window) (edebug-window-live-p window) + (eq (window-buffer window) buffer)) + window) + ((eq (window-buffer (selected-window)) buffer) + ;; Selected window already displays BUFFER. + (selected-window)) + ((edebug-get-buffer-window buffer)) + ((one-window-p 'nomini) + ;; When there's one window only, split it. + (split-window)) + ((let ((trace-window (get-buffer-window edebug-trace-buffer))) + (catch 'found + (dolist (elt (window-list nil 'nomini)) + (unless (or (eq elt (selected-window)) (eq elt trace-window) + (window-dedicated-p elt)) + ;; Found a non-dedicated window not showing + ;; `edebug-trace-buffer', use it. + (throw 'found elt)))))) + ;; All windows are dedicated or show `edebug-trace-buffer', split + ;; selected one. + (t (split-window)))) + (select-window window) + (set-window-buffer window buffer) + (set-window-hscroll window 0);; should this be?? ;; Selecting the window does not set the buffer until command loop. ;;(set-buffer buffer) ) - (defun edebug-get-displayed-buffer-points () ;; Return a list of buffer point pairs, for all displayed buffers. (let (list) @@ -2755,7 +2763,8 @@ MSG is printed after `::::} '." ) ; if edebug-save-windows ;; Restore current buffer always, in case application needs it. - (set-buffer edebug-outside-buffer) + (if (buffer-name edebug-outside-buffer) + (set-buffer edebug-outside-buffer)) ;; Restore point, and mark. ;; Needed even if restoring windows because ;; that doesn't restore point and mark in the current buffer. diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el index 3649757f782..9fec81ec2c5 100644 --- a/lisp/emacs-lisp/ewoc.el +++ b/lisp/emacs-lisp/ewoc.el @@ -191,8 +191,9 @@ BUT if it is the header or the footer in EWOC return nil instead." (not (eq dll node)))) (setq node (ewoc--node-right node)))))) -(defun ewoc--insert-new-node (node data pretty-printer) +(defun ewoc--insert-new-node (node data pretty-printer dll) "Insert before NODE a new node for DATA, displayed by PRETTY-PRINTER. +Fourth arg DLL -- from `(ewoc--dll EWOC)' -- is for internal purposes. Call PRETTY-PRINTER with point at NODE's start, thus pushing back NODE and leaving the new node's start there. Return the new node." (save-excursion @@ -262,8 +263,8 @@ fourth arg NOSEP non-nil inhibits this." (unless header (setq header "")) (unless footer (setq footer "")) (setf (ewoc--node-start-marker dll) (copy-marker pos) - foot (ewoc--insert-new-node dll footer hf-pp) - head (ewoc--insert-new-node foot header hf-pp) + foot (ewoc--insert-new-node dll footer hf-pp dll) + head (ewoc--insert-new-node foot header hf-pp dll) (ewoc--hf-pp new-ewoc) hf-pp (ewoc--footer new-ewoc) foot (ewoc--header new-ewoc) head)) @@ -301,7 +302,7 @@ Return the new node." "Enter a new element DATA before NODE in EWOC. Return the new node." (ewoc--set-buffer-bind-dll ewoc - (ewoc--insert-new-node node data (ewoc--pretty-printer ewoc)))) + (ewoc--insert-new-node node data (ewoc--pretty-printer ewoc) dll))) (defun ewoc-next (ewoc node) "Return the node in EWOC that follows NODE. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 09cb8436c89..164756dfdc3 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1280,7 +1280,8 @@ and initial semicolons." "\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)")) (paragraph-separate (concat paragraph-separate "\\|\\s-*\".*[,\\.]$")) - (fill-column (if (integerp emacs-lisp-docstring-fill-column) + (fill-column (if (and (integerp emacs-lisp-docstring-fill-column) + (derived-mode-p 'emacs-lisp-mode)) emacs-lisp-docstring-fill-column fill-column))) (fill-paragraph justify)) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 947b4063ad4..5254a8389b4 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -582,8 +582,7 @@ symbols with function definitions are considered. Otherwise, all symbols with function definitions, values or properties are considered." (interactive) - - (let ((window (get-buffer-window "*Completions*"))) + (let ((window (get-buffer-window "*Completions*" 0))) (if (and (eq last-command this-command) window (window-live-p window) (window-buffer window) (buffer-name (window-buffer window))) diff --git a/lisp/emacs-lisp/sregex.el b/lisp/emacs-lisp/sregex.el index 447691d4046..8041aefc077 100644 --- a/lisp/emacs-lisp/sregex.el +++ b/lisp/emacs-lisp/sregex.el @@ -425,7 +425,7 @@ Here are the clauses allowed in an `sregex' or `sregexq' expression: Stands for \"\\\\'\", matching the empty string at the end of text. - the symbol `point' - Stands for \"\\\\=\", matching the empty string at point. + Stands for \"\\\\=\\=\", matching the empty string at point. - the symbol `word-boundary' Stands for \"\\\\b\", matching the empty string at the beginning or diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el index d8c171e111d..7d7e788523b 100644 --- a/lisp/emacs-lisp/testcover.el +++ b/lisp/emacs-lisp/testcover.el @@ -190,7 +190,7 @@ call to one of the `testcover-1value-functions'." changes the instrumentation from edebug to testcover--much faster, no problems with type-ahead or post-command-hook, etc. If BYTE-COMPILE is non-nil, byte-compiles each function after instrumenting." - (interactive "f") + (interactive "fStart covering file: ") (let ((buf (find-file filename)) (load-read-function 'testcover-read) (edebug-all-defs t)) @@ -428,10 +428,10 @@ FUN should be `testcover-reinstrument' for compositional functions, list) result)) -(defun testcover-end (buffer) +(defun testcover-end (filename) "Turn off instrumentation of all macros and functions in FILENAME." - (interactive "b") - (let ((buf (find-file-noselect buffer))) + (interactive "fStop covering file: ") + (let ((buf (find-file-noselect filename))) (eval-buffer buf t))) @@ -513,7 +513,7 @@ eliminated by adding more test cases." (defun testcover-mark-all (&optional buffer) "Mark all forms in BUFFER that did not get completley tested during coverage tests. This function creates many overlays." - (interactive "b") + (interactive "bMark forms in buffer: ") (if buffer (switch-to-buffer buffer)) (goto-char 1) @@ -523,7 +523,7 @@ coverage tests. This function creates many overlays." (defun testcover-unmark-all (buffer) "Remove all overlays from FILENAME." - (interactive "b") + (interactive "bUnmark forms in buffer: ") (condition-case nil (progn (set-buffer buffer) diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index db6586838bb..092611632ca 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -360,11 +360,16 @@ This function is called, by name, directly by the C code." (defun run-at-time (time repeat function &rest args) "Perform an action at time TIME. Repeat the action every REPEAT seconds, if REPEAT is non-nil. -TIME should be a string like \"11:23pm\", nil meaning now, a number of seconds -from now, a value from `current-time', or t (with non-nil REPEAT) -meaning the next integral multiple of REPEAT. -REPEAT may be an integer or floating point number. -The action is to call FUNCTION with arguments ARGS. +TIME should be one of: a string giving an absolute time like +\"11:23pm\" (the acceptable formats are those recognized by +`diary-entry-time'; note that such times are interpreted as times +today, even if in the past); a string giving a relative time like +\"2 hours 35 minutes\" (the acceptable formats are those +recognized by `timer-duration'); nil meaning now; a number of +seconds from now; a value from `encode-time'; or t (with non-nil +REPEAT) meaning the next integral multiple of REPEAT. REPEAT may +be an integer or floating point number. The action is to call +FUNCTION with arguments ARGS. This function returns a timer object which you can use in `cancel-timer'." (interactive "sRun at time: \nNRepeat interval: \naFunction: ") @@ -385,7 +390,7 @@ This function returns a timer object which you can use in `cancel-timer'." (if (numberp time) (setq time (timer-relative-time (current-time) time))) - ;; Handle relative times like "2 hours and 35 minutes" + ;; Handle relative times like "2 hours 35 minutes" (if (stringp time) (let ((secs (timer-duration time))) (if secs diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index b75f0fd242f..99b0b3f3448 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -218,8 +218,9 @@ Default is :warning. but raise suspicion of a possible problem. :debug -- info for debugging only. -BUFFER-NAME, if specified, is the name of the buffer for logging the -warning. By default, it is `*Warnings*'. +BUFFER-NAME, if specified, is the name of the buffer for logging +the warning. By default, it is `*Warnings*'. If this function +has to create the buffer, it disables undo in the buffer. See the `warnings' custom group for user customization features. @@ -227,16 +228,22 @@ See also `warning-series', `warning-prefix-function' and `warning-fill-prefix' for additional programming features." (unless level (setq level :warning)) + (unless buffer-name + (setq buffer-name "*Warnings*")) (if (assq level warning-level-aliases) (setq level (cdr (assq level warning-level-aliases)))) (or (< (warning-numeric-level level) (warning-numeric-level warning-minimum-log-level)) (warning-suppress-p type warning-suppress-log-types) (let* ((typename (if (consp type) (car type) type)) - (buffer (get-buffer-create (or buffer-name "*Warnings*"))) + (old (get-buffer buffer-name)) + (buffer (get-buffer-create buffer-name)) (level-info (assq level warning-levels)) start end) (with-current-buffer buffer + ;; If we created the buffer, disable undo. + (unless old + (setq buffer-undo-list t)) (goto-char (point-max)) (when (and warning-series (symbolp warning-series)) (setq warning-series |