summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-04-09 15:54:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-04-09 15:54:59 -0700
commit45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193 (patch)
tree5bc87a8b5a3c754b8eb44a612cc6c03561d6b968 /lisp/emacs-lisp
parent9d6b4d53469a9ffd67bd770fabc6fe254e35c21d (diff)
parent05920a43fc18e696b464387e781e7cfdcea5b5af (diff)
downloademacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.tar.gz
emacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.tar.bz2
emacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.zip
Merge from trunk.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/authors.el1
-rw-r--r--lisp/emacs-lisp/avl-tree.el16
-rw-r--r--lisp/emacs-lisp/byte-opt.el2
-rw-r--r--lisp/emacs-lisp/bytecomp.el7
-rw-r--r--lisp/emacs-lisp/chart.el2
-rw-r--r--lisp/emacs-lisp/copyright.el2
-rw-r--r--lisp/emacs-lisp/edebug.el15
-rw-r--r--lisp/emacs-lisp/eieio.el6
-rw-r--r--lisp/emacs-lisp/ert.el2
-rw-r--r--lisp/emacs-lisp/package.el25
-rw-r--r--lisp/emacs-lisp/ring.el33
-rw-r--r--lisp/emacs-lisp/tabulated-list.el9
-rw-r--r--lisp/emacs-lisp/timer.el2
13 files changed, 77 insertions, 45 deletions
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el
index 22e0ade987d..6f2c6f73eca 100644
--- a/lisp/emacs-lisp/authors.el
+++ b/lisp/emacs-lisp/authors.el
@@ -170,6 +170,7 @@ files.")
("Thomas Dye" "Tom Dye")
("Thomas Horsley" "Tom Horsley") ; FIXME ?
("Thomas Wurgler" "Tom Wurgler")
+ ("Toby Cubitt" "Toby S\\. Cubitt")
("Tomohiko Morioka" "MORIOKA Tomohiko")
("Torbjörn Axelsson" "Torbjvrn Axelsson")
("Torbjörn Einarsson" "Torbj.*rn Einarsson")
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index cb5ea048999..9f348767478 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -295,9 +295,9 @@ Return t if the height of the tree has grown."
(if (> (* sgn b2) 0) (- sgn) 0)
(avl-tree--node-balance p1)
(if (< (* sgn b2) 0) sgn 0)
- (avl-tree--node-branch node branch) p2
- (avl-tree--node-balance
- (avl-tree--node-branch node branch)) 0))
+ (avl-tree--node-branch node branch) p2))
+ (setf (avl-tree--node-balance
+ (avl-tree--node-branch node branch)) 0)
nil))))
(defun avl-tree--do-enter (cmpfun root branch data &optional updatefun)
@@ -339,6 +339,16 @@ inserted data."
(cons nil newdata)) ; return value
))))
+(defun avl-tree--check (tree)
+ "Check the tree's balance."
+ (avl-tree--check-node (avl-tree--root tree)))
+(defun avl-tree--check-node (node)
+ (if (null node) 0
+ (let ((dl (avl-tree--check-node (avl-tree--node-left node)))
+ (dr (avl-tree--check-node (avl-tree--node-right node))))
+ (assert (= (- dr dl) (avl-tree--node-balance node)))
+ (1+ (max dl dr)))))
+
;; ----------------------------------------------------------------
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 78ac29d89df..3b324a09659 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1237,7 +1237,7 @@
string-to-multibyte
tan truncate
unibyte-char-to-multibyte upcase user-full-name
- user-login-name user-original-login-name user-variable-p
+ user-login-name user-original-login-name custom-variable-p
vconcat
window-buffer window-dedicated-p window-edges window-height
window-hscroll window-minibuffer-p window-width
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2ee878e5213..93c6518d215 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2694,7 +2694,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
(limits '(5 ; Use the 1-byte varref codes,
63 ; 1-constlim ; 1-byte byte-constant codes,
255 ; 2-byte varref codes,
- 65535)) ; 3-byte codes for the rest.
+ 65535 ; 3-byte codes for the rest.
+ 65535)) ; twice since we step when we swap.
limit)
(while (or rest other)
(setq limit (car limits))
@@ -2708,8 +2709,8 @@ If FORM is a lambda or a macro, byte-compile it as a function."
(setcdr (car rest) (setq i (1+ i)))
(setq ret (cons (car rest) ret))))
(setq rest (cdr rest)))
- (setq limits (cdr limits)
- rest (prog1 other
+ (setq limits (cdr limits) ;Step
+ rest (prog1 other ;&Swap.
(setq other rest))))
(apply 'vector (nreverse (mapcar 'car ret)))))
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index 19766feac5a..2e3abb2e9d3 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -82,7 +82,7 @@ Colors will be the background color.")
Useful if new Emacs is used on B&W display.")
(defcustom chart-face-use-pixmaps nil
- "*Non-nil to use fancy pixmaps in the background of chart face colors."
+ "Non-nil to use fancy pixmaps in the background of chart face colors."
:group 'eieio
:type 'boolean)
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index a77998aa6d9..09b456b54ba 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -85,7 +85,7 @@ The second \\( \\) construct must match the years."
"Non-nil if individual consecutive years should be replaced with a range.
For example: 2005, 2006, 2007, 2008 might be replaced with 2005-2008.
If you use ranges, you should add an explanatory note in a README file.
-The function `copyright-fix-year' respects this variable."
+The function `copyright-fix-years' respects this variable."
:group 'copyright
:type 'boolean
:version "24.1")
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index c241ac710cf..f47feebe5d2 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1,6 +1,6 @@
;;; edebug.el --- a source-level debugger for Emacs Lisp
-;; Copyright (C) 1988-1995, 1997, 1999-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1988-1995, 1997, 1999-2012 Free Software Foundation, Inc.
;; Author: Daniel LaLiberte <liberte@holonexus.org>
;; Maintainer: FSF
@@ -191,6 +191,7 @@ Use this with caution since it is not debugged."
(defcustom edebug-unwrap-results nil
"Non-nil if Edebug should unwrap results of expressions.
+That is, Edebug will try to remove its own instrumentation from the result.
This is useful when debugging macros where the results of expressions
are instrumented expressions. But don't do this when results might be
circular or an infinite loop will result."
@@ -2028,7 +2029,10 @@ expressions; a `progn' form will be returned enclosing these forms."
(def-edebug-spec apply (function-form &rest form))
(def-edebug-spec funcall (function-form &rest form))
-;; FIXME? The manual has a gate here.
+;; FIXME? The manual uses this form (maybe that's just for illustration?):
+;; (def-edebug-spec let
+;; ((&rest &or symbolp (gate symbolp &optional form))
+;; body))
(def-edebug-spec let
((&rest &or (symbolp &optional form) symbolp)
body))
@@ -3740,7 +3744,7 @@ This prints the value into current buffer."
;; FIXME eh?
(defvar gud-inhibit-global-bindings
- "*Non-nil means don't do global rebindings of C-x C-a subcommands.")
+ "Non-nil means don't do global rebindings of C-x C-a subcommands.")
;; Global GUD bindings for all emacs-lisp-mode buffers.
(unless gud-inhibit-global-bindings
@@ -4157,6 +4161,8 @@ You must include newlines in FMT to break lines, but one newline is appended."
;;; Frequency count and coverage
;; FIXME should this use overlays instead?
+;; Definitely, IMO. The current business with undo in
+;; edebug-temp-display-freq-count is horrid.
(defun edebug-display-freq-count ()
"Display the frequency count data for each line of the current definition.
The frequency counts are inserted as comment lines after each line,
@@ -4226,6 +4232,8 @@ reinstrument it."
(insert "\n")
(setq i first-index)))))
+;; FIXME this does not work very well. Eg if you press an arrow key,
+;; or make a mouse-click, it fails with "Non-character input-event".
(defun edebug-temp-display-freq-count ()
"Temporarily display the frequency count data for the current definition.
It is removed when you hit any char."
@@ -4235,6 +4243,7 @@ It is removed when you hit any char."
(undo-boundary)
(edebug-display-freq-count)
(setq unread-command-char (read-char))
+ ;; Yuck! This doesn't seem to work at all for me.
(undo)))
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index cdf7237b766..f1c1bf8965c 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -79,7 +79,7 @@
;;
(defvar eieio-hook nil
- "*This hook is executed, then cleared each time `defclass' is called.")
+ "This hook is executed, then cleared each time `defclass' is called.")
(defvar eieio-error-unsupported-class-tags nil
"Non-nil to throw an error if an encountered tag is unsupported.
@@ -87,7 +87,7 @@ This may prevent classes from CLOS applications from being used with EIEIO
since EIEIO does not support all CLOS tags.")
(defvar eieio-skip-typecheck nil
- "*If non-nil, skip all slot typechecking.
+ "If non-nil, skip all slot typechecking.
Set this to t permanently if a program is functioning well to get a
small speed increase. This variable is also used internally to handle
default setting for optimization purposes.")
@@ -2044,7 +2044,7 @@ During executions, the list is first generated, then as each next method
is called, the next method is popped off the stack.")
(defvar eieio-pre-method-execution-hooks nil
- "*Hooks run just before a method is executed.
+ "Hooks run just before a method is executed.
The hook function must accept one argument, the list of forms
about to be executed.")
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 9cbe29bf322..ad5e20cb8a4 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1405,7 +1405,7 @@ RESULT must be an `ert-test-result-with-condition'."
;;; Running tests in batch mode.
(defvar ert-batch-backtrace-right-margin 70
- "*The maximum line length for printing backtraces in `ert-run-tests-batch'.")
+ "The maximum line length for printing backtraces in `ert-run-tests-batch'.")
;;;###autoload
(defun ert-run-tests-batch (&optional selector)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ff4fbe3ead4..5b158eb994f 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4,7 +4,7 @@
;; Author: Tom Tromey <tromey@redhat.com>
;; Created: 10 Mar 2007
-;; Version: 0.9
+;; Version: 1.0
;; Keywords: tools
;; This file is part of GNU Emacs.
@@ -607,16 +607,25 @@ untar into a directory named DIR; otherwise, signal an error."
(error "Package does not untar cleanly into directory %s/" dir))))
(tar-untar-buffer))
-(defun package-unpack (name version)
- (let* ((dirname (concat (symbol-name name) "-" version))
+(defun package-unpack (package version)
+ (let* ((name (symbol-name package))
+ (dirname (concat name "-" version))
(pkg-dir (expand-file-name dirname package-user-dir)))
(make-directory package-user-dir t)
;; FIXME: should we delete PKG-DIR if it exists?
(let* ((default-directory (file-name-as-directory package-user-dir)))
(package-untar-buffer dirname)
- (package-generate-autoloads (symbol-name name) pkg-dir)
- (let ((load-path (cons pkg-dir load-path)))
- (byte-recompile-directory pkg-dir 0 t)))))
+ (package--make-autoloads-and-compile name pkg-dir))))
+
+(defun package--make-autoloads-and-compile (name pkg-dir)
+ "Generate autoloads and do byte-compilation for package named NAME.
+PKG-DIR is the name of the package directory."
+ (package-generate-autoloads name pkg-dir)
+ (let ((load-path (cons pkg-dir load-path)))
+ ;; We must load the autoloads file before byte compiling, in
+ ;; case there are magic cookies to set up non-trivial paths.
+ (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)
+ (byte-recompile-directory pkg-dir 0 t)))
(defun package--write-file-no-coding (file-name)
(let ((buffer-file-coding-system 'no-conversion))
@@ -656,9 +665,7 @@ untar into a directory named DIR; otherwise, signal an error."
nil
pkg-file
nil nil nil 'excl))
- (package-generate-autoloads file-name pkg-dir)
- (let ((load-path (cons pkg-dir load-path)))
- (byte-recompile-directory pkg-dir 0 t)))))
+ (package--make-autoloads-and-compile file-name pkg-dir))))
(defmacro package--with-work-buffer (location file &rest body)
"Run BODY in a buffer containing the contents of FILE at LOCATION.
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index 4b07de523c3..cee6a43df86 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -185,26 +185,31 @@ Raise error if ITEM is not in the RING."
(unless curr-index (error "Item is not in the ring: `%s'" item))
(ring-ref ring (ring-minus1 curr-index (ring-length ring)))))
+(defun ring-extend (ring x)
+ "Increase the size of RING by X."
+ (when (and (integerp x) (> x 0))
+ (let* ((hd (car ring))
+ (length (ring-length ring))
+ (size (ring-size ring))
+ (old-vec (cddr ring))
+ (new-vec (make-vector (+ size x) nil)))
+ (setcdr ring (cons length new-vec))
+ ;; If the ring is wrapped, the existing elements must be written
+ ;; out in the right order.
+ (dotimes (j length)
+ (aset new-vec j (aref old-vec (mod (+ hd j) size))))
+ (setcar ring 0))))
+
(defun ring-insert+extend (ring item &optional grow-p)
"Like `ring-insert', but if GROW-P is non-nil, then enlarge ring.
Insert onto ring RING the item ITEM, as the newest (last) item.
If the ring is full, behavior depends on GROW-P:
If GROW-P is non-nil, enlarge the ring to accommodate the new item.
If GROW-P is nil, dump the oldest item to make room for the new."
- (let* ((vec (cddr ring))
- (veclen (length vec))
- (hd (car ring))
- (ringlen (ring-length ring)))
- (prog1
- (cond ((and grow-p (= ringlen veclen)) ; Full ring. Enlarge it.
- (setq veclen (1+ veclen))
- (setcdr ring (cons (setq ringlen (1+ ringlen))
- (setq vec (vconcat vec (vector item)))))
- (setcar ring hd))
- (t (aset vec (mod (+ hd ringlen) veclen) item)))
- (if (= ringlen veclen)
- (setcar ring (ring-plus1 hd veclen))
- (setcar (cdr ring) (1+ ringlen))))))
+ (and grow-p
+ (= (ring-length ring) (ring-size ring))
+ (ring-extend ring 1))
+ (ring-insert ring item))
(defun ring-remove+insert+extend (ring item &optional grow-p)
"`ring-remove' ITEM from RING, then `ring-insert+extend' it.
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 8fe514ab551..f17b12da6a0 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -278,11 +278,10 @@ of column descriptors."
(width (nth 1 format))
(label (if (stringp desc) desc (car desc)))
(help-echo (concat (car format) ": " label)))
- ;; Truncate labels if necessary.
- (and (> width 6)
- (> (length label) width)
- (setq label (concat (substring label 0 (- width 3))
- "...")))
+ ;; Truncate labels if necessary (except last column).
+ (and (< (1+ n) len)
+ (> (string-width label) width)
+ (setq label (truncate-string-to-width label width nil nil t)))
(setq label (bidi-string-mark-left-to-right label))
(if (stringp desc)
(insert (propertize label 'help-echo help-echo))
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index b6b7c266263..87b6cceb24b 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -241,7 +241,7 @@ and idle timers such as are scheduled by `run-with-idle-timer'."
"Third-to-last timer that was run.")
(defvar timer-max-repeats 10
- "*Maximum number of times to repeat a timer, if many repeats are delayed.
+ "Maximum number of times to repeat a timer, if many repeats are delayed.
Timer invocations can be delayed because Emacs is suspended or busy,
or because the system's time changes. If such an occurrence makes it
appear that many invocations are overdue, this variable controls