commit 57abaae56a4a1549f6a154fecad16f47fc0bba9e (HEAD, refs/remotes/origin/master) Author: Thomas Fitzsimmons Date: Fri Feb 6 00:29:46 2015 -0500 net/ldap.el (ldap-search-internal): Fix docstring diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b60e410..31f10d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-02-06 Thomas Fitzsimmons + + * net/ldap.el (ldap-search-internal): Fix docstring. + 2015-02-06 Lars Ingebrigtsen * subr.el (define-error): The error conditions may be constant diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index a77fc3c..1df975a 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -546,8 +546,8 @@ not their associated values. `auth' is one of the symbols `simple', `krbv41' or `krbv42'. `base' is the base for the search as described in RFC 1779. `scope' is one of the three symbols `sub', `base' or `one'. - `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax). - `auth' is one of the symbols `simple', `krbv41' or `krbv42' + `binddn' is the distinguished name of the user to bind as (in +RFC 1779 syntax). `passwd' is the password to use for simple authentication. `deref' is one of the symbols `never', `always', `search' or `find'. `timelimit' is the timeout limit for the connection in seconds. commit 3fc745d5de3ef7825345132dbcd20784e5cab0e3 Author: Lars Magne Ingebrigtsen Date: Fri Feb 6 14:04:13 2015 +1100 Fix json error-definition condition build error * lisp/subr.el (define-error): The error conditions may be constant lists, so use `append' to concatenate them. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 60746ce..b60e410 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-06 Lars Ingebrigtsen + + * subr.el (define-error): The error conditions may be constant + lists, so use `append' to concatenate them. + 2015-02-06 Wolfgang Jenkner * net/network-stream.el (network-stream-open-tls): Respect the diff --git a/lisp/subr.el b/lisp/subr.el index 68cd230..3b27b33 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -316,7 +316,7 @@ Defaults to `error'." (unless parent (setq parent 'error)) (let ((conditions (if (consp parent) - (apply #'nconc + (apply #'append (mapcar (lambda (parent) (cons parent (or (get parent 'error-conditions) commit bc4996520a3919bfc52e6fd95f6a0cb7c4c085aa Author: Wolfgang Jenkner Date: Fri Feb 6 13:43:58 2015 +1100 Respect the :end-of-capability setting * lisp/net/network-stream.el (network-stream-open-tls): Respect the :end-of-capability setting. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dc85bea..60746ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-06 Wolfgang Jenkner + + * net/network-stream.el (network-stream-open-tls): Respect the + :end-of-capability setting. + 2015-02-05 Artur Malabarba * emacs-lisp/package.el (package--sort-by-dependence): New diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index e7b3150..0104fa7 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -374,10 +374,12 @@ asynchronously, if possible." (when (re-search-forward eoc nil t) (goto-char (match-beginning 0)) (delete-region (point-min) (line-beginning-position)))) - (let* ((capability-command (plist-get parameters :capability-command))) + (let ((capability-command (plist-get parameters :capability-command)) + (eo-capa (or (plist-get parameters :end-of-capability) + eoc))) (list stream (network-stream-get-response stream start eoc) - (network-stream-command stream capability-command eoc) + (network-stream-command stream capability-command eo-capa) 'tls)))))) (defun network-stream-open-shell (name buffer host service parameters) commit f4d7de6f9cee7e10ecf8c56d6bb14e23372e08dc Author: Artur Malabarba Date: Thu Feb 5 21:41:02 2015 -0200 emacs-lisp/package.el: Add missing (require 'subr-x) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b24b2af..dc85bea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -9,6 +9,8 @@ (package-delete): Don't delesect when deleting an older version of an upgraded package. + * emacs-lisp/package.el: Add missing (require 'subr-x) + 2015-02-05 Stefan Monnier * textmodes/css-mode.el (scss-smie--not-interpolation-p): Vars can be diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f19cca5..c3a2061 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -161,6 +161,7 @@ ;;; Code: +(eval-when-compile (require 'subr-x)) (eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'epg)) ;For setf accessors. commit a844b9407496aeaa6945f4611e57e4b0e69ada18 Author: Artur Malabarba Date: Thu Feb 5 20:47:28 2015 -0200 emacs-lisp/package.el (package-delete): Don't always delesect. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 37e922a..b24b2af 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -5,6 +5,9 @@ (package-menu-execute): Use it to delete packages in order. (package--sort-deps-in-alist): New function. (package-menu-mark-install): Can mark dependencies. + (package--newest-p): New function. + (package-delete): Don't delesect when deleting an older version of + an upgraded package. 2015-02-05 Stefan Monnier diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index f117906..f19cca5 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1510,6 +1510,11 @@ with PKG-DESC entry removed." (and (memq pkg (mapcar #'car (package-desc-reqs (cadr p)))) (car p)))))) +(defun package--newest-p (pkg) + "Return t if PKG is the newest package with its name." + (equal (cadr (assq (package-desc-name pkg) package-alist)) + pkg)) + (defun package-delete (pkg-desc &optional force nosave) "Delete package PKG-DESC. @@ -1527,7 +1532,10 @@ If NOSAVE is non-nil, the package is not removed from ;; don't want it marked as selected, so we remove it from ;; `package-selected-packages' even if it can't be deleted. (when (and (null nosave) - (package--user-selected-p name)) + (package--user-selected-p name) + ;; Don't delesect if this is an older version of an + ;; upgraded package. + (package--newest-p pkg-desc)) (customize-save-variable 'package-selected-packages (remove name package-selected-packages))) (cond ((not (string-prefix-p (file-name-as-directory commit b2c4997c823a32e79c9f16b547b491463da9c1c2 Author: Artur Malabarba Date: Thu Feb 5 20:33:23 2015 -0200 emacs-lisp/package.el (package-menu-mark-install): Mark dependency. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be03e56..37e922a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,7 @@ function. Return PACKAGE-LIST sorted by dependencies. (package-menu-execute): Use it to delete packages in order. (package--sort-deps-in-alist): New function. + (package-menu-mark-install): Can mark dependencies. 2015-02-05 Stefan Monnier diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 2932efa..f117906 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2262,7 +2262,7 @@ If optional arg BUTTON is non-nil, describe its associated package." (defun package-menu-mark-install (&optional _num) "Mark a package for installation and move to the next line." (interactive "p") - (if (member (package-menu-get-status) '("available" "new")) + (if (member (package-menu-get-status) '("available" "new" "dependency")) (tabulated-list-put-tag "I" t) (forward-line))) @@ -2418,7 +2418,13 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." (mapconcat #'package-desc-full-name install-list ", "))))) (mapc (lambda (p) - (package-install p (null (package-installed-p p)))) + ;; Mark as selected if it's the exact version of a + ;; package that's already installed, or if it's not + ;; installed at all. Don't mark if it's a new + ;; version of an installed package. + (package-install p (or (package-installed-p p) + (not (package-installed-p + (package-desc-name p)))))) install-list))) ;; Delete packages, prompting if necessary. (when delete-list commit de840e433c8de436fcbbe0a9eb3fbde0b2a33070 Author: Artur Malabarba Date: Thu Feb 5 19:47:49 2015 -0200 automated/package-test.el (package-test-sort-by-dependence): New test diff --git a/test/ChangeLog b/test/ChangeLog index 1aa82a7..23c4870 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,7 @@ 2015-02-05 Artur Malabarba * automated/package-test.el (package-test-get-deps): Fix typo. + (package-test-sort-by-dependence): New test 2015-02-03 Artur Malabarba diff --git a/test/automated/package-test.el b/test/automated/package-test.el index cf189dd..7d2a343 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -526,6 +526,32 @@ Must called from within a `tar-mode' buffer." (equal (package--get-deps 'simple-depend-2 'direct) '(simple-depend-1 multi-file))))) +(ert-deftest package-test-sort-by-dependence () + "Test `package--sort-by-dependence' with complex structures." + (let ((package-alist + (mapcar (lambda (p) (list (package-desc-name p) p)) + (list simple-single-desc + simple-depend-desc + multi-file-desc + new-pkg-desc + simple-depend-desc-1 + simple-depend-desc-2))) + (delete-list + (list simple-single-desc + simple-depend-desc + multi-file-desc + new-pkg-desc + simple-depend-desc-1 + simple-depend-desc-2))) + (should + (equal (package--sort-by-dependence delete-list) + (list simple-depend-desc-2 simple-depend-desc-1 new-pkg-desc + multi-file-desc simple-depend-desc simple-single-desc))) + (should + (equal (package--sort-by-dependence (reverse delete-list)) + (list new-pkg-desc simple-depend-desc-2 simple-depend-desc-1 + multi-file-desc simple-depend-desc simple-single-desc))))) + (provide 'package-test) ;;; package-test.el ends here commit c03deb4df98d13239b14f2d01423dd39fdc80404 Author: Artur Malabarba Date: Thu Feb 5 19:39:41 2015 -0200 automated/package-test.el (package-test-get-deps): Fix typo. diff --git a/test/ChangeLog b/test/ChangeLog index 56e3ac0..1aa82a7 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2015-02-05 Artur Malabarba + + * automated/package-test.el (package-test-get-deps): Fix typo. + 2015-02-03 Artur Malabarba * automated/package-test.el (package-test-get-deps): New test. diff --git a/test/automated/package-test.el b/test/automated/package-test.el index 004e2e8..cf189dd 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -498,7 +498,7 @@ Must called from within a `tar-mode' buffer." (list 1 package-x-test--single-archive-entry-1-4)))))) (ert-deftest package-test-get-deps () - "Test `package-test-get-deps' with complex structures." + "Test `package--get-deps' with complex structures." (let ((package-alist (mapcar (lambda (p) (list (package-desc-name p) p)) (list simple-single-desc commit 3c5ac257029ddc60caf87a6ed4e229ceb3fbf9f6 Author: Artur Malabarba Date: Thu Feb 5 19:36:59 2015 -0200 emacs-lisp/package.el (package-menu-execute): Delete packages in order. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9b5642..be03e56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2015-02-05 Artur Malabarba + + * emacs-lisp/package.el (package--sort-by-dependence): New + function. Return PACKAGE-LIST sorted by dependencies. + (package-menu-execute): Use it to delete packages in order. + (package--sort-deps-in-alist): New function. + 2015-02-05 Stefan Monnier * textmodes/css-mode.el (scss-smie--not-interpolation-p): Vars can be diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 67cd44d..2932efa 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2351,6 +2351,40 @@ call will upgrade the package." (length upgrades) (if (= (length upgrades) 1) "" "s"))))) +(defun package--sort-deps-in-alist (package only) + "Return a list of dependencies for PACKAGE sorted by dependency. +PACKAGE is included as the first element of the returned list. +ONLY is an alist associating package names to package objects. +Only these packages will be in the return value an their cdrs are +destructively set to nil in ONLY." + (let ((out)) + (dolist (dep (package-desc-reqs package)) + (when-let ((cell (assq (car dep) only)) + (dep-package (cdr-safe cell))) + (setcdr cell nil) + (setq out (append (package--sort-deps-in-alist dep-package only) + out)))) + (cons package out))) + +(defun package--sort-by-dependence (package-list) + "Return PACKAGE-LIST sorted by dependence. +That is, any element of the returned list is guaranteed to not +directly depend on any elements that come before it. + +PACKAGE-LIST is a list of package-desc objects. +Indirect dependencies are guaranteed to be returned in order only +if all the in-between dependencies are also in PACKAGE-LIST." + (let ((alist (mapcar (lambda (p) (cons (package-desc-name p) p)) package-list)) + out-list) + (dolist (cell alist out-list) + ;; `package--sort-deps-in-alist' destructively changes alist, so + ;; some cells might already be empty. We check this here. + (when-let ((pkg-desc (cdr cell))) + (setcdr cell nil) + (setq out-list + (append (package--sort-deps-in-alist pkg-desc alist) + out-list)))))) + (defun package-menu-execute (&optional noquery) "Perform marked Package Menu actions. Packages marked for installation are downloaded and installed; @@ -2398,7 +2432,7 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." (length delete-list) (mapconcat #'package-desc-full-name delete-list ", "))))) - (dolist (elt delete-list) + (dolist (elt (package--sort-by-dependence delete-list)) (condition-case-unless-debug err (package-delete elt) (error (message (cadr err))))) @@ -2412,7 +2446,8 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." (format "These %d packages are no longer needed, delete them (%s)? " (length removable) (mapconcat #'symbol-name removable ", ")))) - (mapc (lambda (p) (package-delete (cadr (assq p package-alist)))) + ;; We know these are removable, so we can use force instead of sorting them. + (mapc (lambda (p) (package-delete (cadr (assq p package-alist)) 'force 'nosave)) removable)))) (package-menu--generate t t)))) commit 6b1d71150b80dfbe4d50e78e6b4fb259931ac907 Author: Simen Heggestøyl Date: Thu Feb 5 15:35:36 2015 -0500 * lisp/textmodes/css-mode.el: Handle hyphenated vars Fixes: debbugs:19263 * lisp/textmodes/css-mode.el (scss-smie--not-interpolation-p): Vars can be hyphenated. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 62c4e9a..f9b5642 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,7 @@ -2015-02-05 Simen Heggestøyl (tiny change) +2015-02-05 Stefan Monnier + + * textmodes/css-mode.el (scss-smie--not-interpolation-p): Vars can be + hyphenated (bug#19263). * textmodes/css-mode.el (css-fill-paragraph): Fix filling in presence of variable interpolation (bug#19751). diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index fbaa486..f6a3ca6 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -455,7 +455,7 @@ (defun scss-smie--not-interpolation-p () (save-excursion (forward-char -1) - (or (zerop (skip-chars-backward "[:alnum:]")) + (or (zerop (skip-chars-backward "-[:alnum:]")) (not (looking-back "#{\\$" (- (point) 3)))))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode)) commit 8c80eb48170eb2f02adaae08442d187eeecfbefa Author: Simen Heggestøyl Date: Thu Feb 5 15:29:54 2015 -0500 * lisp/textmodes/css-mode.el: Handle variable interpolation Fixes: debbugs:19751 * lisp/textmodes/css-mode.el (css-fill-paragraph): Fix filling in presence of variable interpolation. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9838d68..62c4e9a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Simen Heggestøyl (tiny change) + + * textmodes/css-mode.el (css-fill-paragraph): Fix filling in presence + of variable interpolation (bug#19751). + 2015-02-05 Era Eriksson * json.el (json-end-of-file): New error (bug#19768). diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index c171bd5..fbaa486 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1,4 +1,4 @@ -;;; css-mode.el --- Major mode to edit CSS files -*- lexical-binding: t -*- +;;; css-mode.el --- Major mode to edit CSS files -*- lexical-binding: t -*- ;; Copyright (C) 2006-2015 Free Software Foundation, Inc. @@ -401,11 +401,16 @@ (cond ;; This is a false positive inside a string or comment. ((nth 8 (syntax-ppss)) nil) + ;; This is a false positive when encountering an + ;; interpolated variable (bug#19751). + ((eq (char-before (- (point) 1)) ?#) nil) ((eq (char-before) ?\}) (save-excursion (forward-char -1) (skip-chars-backward " \t") - (unless (bolp) (newline)))) + (when (and (not (bolp)) + (scss-smie--not-interpolation-p)) + (newline)))) (t (while (progn commit 6aa04a5570b50a68665e69231f3e36b2a4625f40 Author: Era Eriksson Date: Thu Feb 5 14:52:03 2015 -0500 * lisp/json.el (json-end-of-file): New error. Fixes: debbugs:19768 (json-pop, json-read): Use it. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a1e43e14..9838d68 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Era Eriksson + + * json.el (json-end-of-file): New error (bug#19768). + (json-pop, json-read): Use it. + 2015-02-05 Kelly Dean * help-mode.el (help-xref-interned): Pass BUFFER and FRAME to @@ -14384,7 +14389,7 @@ Change default to "# encoding: %s" to differentiate it from the default Ruby encoding comment template. -2013-11-20 era eriksson +2013-11-20 Era Eriksson * ses.el (ses-mode): Doc fix. (Bug#14748) diff --git a/lisp/json.el b/lisp/json.el index 68ab020..98974e6 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -166,7 +166,7 @@ without indentation.") "Advance past the character at point, returning it." (let ((char (json-peek))) (if (eq char :json-eof) - (signal 'end-of-file nil) + (signal 'json-end-of-file nil) (json-advance) char))) @@ -186,6 +186,8 @@ without indentation.") (define-error 'json-string-format "Bad string format" 'json-error) (define-error 'json-key-format "Bad JSON object key" 'json-error) (define-error 'json-object-format "Bad JSON object" 'json-error) +(define-error 'json-end-of-file "End of file while parsing JSON" + '(end-of-file json-error)) @@ -554,7 +556,7 @@ Advances point just past JSON object." (if (functionp (car record)) (apply (car record) (cdr record)) (signal 'json-readtable-error record))) - (signal 'end-of-file nil)))) + (signal 'json-end-of-file nil)))) ;; Syntactic sugar for the reader commit f06902840eff62e83858a40b4e139b61d254107a Merge: 55eb728 72229f1 Author: Stefan Monnier Date: Thu Feb 5 14:44:26 2015 -0500 Merge branch 'dynamic-docstrings' into trunk commit 72229f17ef6609e570e89a1ae86ed80a544e79e8 Author: Stefan Monnier Date: Thu Feb 5 14:43:38 2015 -0500 * lisp/emacs-lisp/eieio*.el: Use (:documentation ...) feature * lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Use new special (:documentation ...) feature. * lisp/emacs-lisp/eieio-core.el (eieio-make-class-predicate) (eieio-make-child-predicate): Same. (eieio-copy-parents-into-subclass): Remove unused arg. (eieio-defclass-internal): Adjust call accordingly and remove redundant `pname' var. (eieio--slot-name-index): Remove unused arg `obj' and adjust all callers accordingly. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 51e944c..ce70d49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,15 @@ 2015-02-05 Stefan Monnier + * emacs-lisp/eieio-compat.el (eieio--defmethod): Use new + special (:documentation ...) feature. + * emacs-lisp/eieio-core.el (eieio-make-class-predicate) + (eieio-make-child-predicate): Same. + (eieio-copy-parents-into-subclass): Remove unused arg. + (eieio-defclass-internal): Adjust call accordingly and remove redundant + `pname' var. + (eieio--slot-name-index): Remove unused arg `obj' and adjust all + callers accordingly. + * emacs-lisp/cconv.el (cconv--convert-function): Add `docstring' argument. (cconv-convert): Use it to handle the new (:documentation ...) form. diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 46585ee..fcf02b9 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -290,8 +290,7 @@ constructor functions are considered valid. Second, any text properties will be stripped from strings." (cond ((consp proposed-value) ;; Lists with something in them need special treatment. - (let ((slot-idx (eieio--slot-name-index class - nil slot)) + (let ((slot-idx (eieio--slot-name-index class slot)) (type nil) (classtype nil)) (setq slot-idx (- slot-idx diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el index fcca99d..7468c04 100644 --- a/lisp/emacs-lisp/eieio-compat.el +++ b/lisp/emacs-lisp/eieio-compat.el @@ -188,11 +188,10 @@ Summary: (args (help-function-arglist code 'preserve-names)) (doc-only (if docstring (let ((split (help-split-fundoc docstring nil))) - (if split (cdr split) docstring)))) - (new-docstring (help-add-fundoc-usage doc-only - (cons 'cl-cnm args)))) - ;; FIXME: ¡Add new-docstring to those closures! + (if split (cdr split) docstring))))) (lambda (cnm &rest args) + (:documentation + (help-add-fundoc-usage doc-only (cons 'cl-cnm args))) (cl-letf (((symbol-function 'call-next-method) cnm) ((symbol-function 'next-method-p) (lambda () (cl--generic-isnot-nnm-p cnm)))) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 77d8c01..fa8fefa 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -288,16 +288,17 @@ It creates an autoload function for CNAME's constructor." (defun eieio-make-class-predicate (class) (lambda (obj) - ;; (:docstring (format "Test OBJ to see if it's an object of type %S." - ;; class)) + (:documentation + (format "Return non-nil if OBJ is an object of type `%S'.\n\n(fn OBJ)" + class)) (and (eieio-object-p obj) (same-class-p obj class)))) (defun eieio-make-child-predicate (class) (lambda (obj) - ;; (:docstring (format - ;; "Test OBJ to see if it's an object is a child of type %S." - ;; class)) + (:documentation + (format "Return non-nil if OBJ is an object of type `%S' or a subclass. +\n(fn OBJ)" class)) (and (eieio-object-p obj) (object-of-class-p obj class)))) @@ -312,8 +313,7 @@ See `defclass' for more information." (run-hooks 'eieio-hook) (setq eieio-hook nil) - (let* ((pname superclasses) - (oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c))) + (let* ((oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c))) (newc (if (and oldc (not (eieio--class-default-object-cache oldc))) ;; The oldc class is a stub setup by eieio-defclass-autoload. ;; Reuse it instead of creating a new one, so that existing @@ -338,9 +338,9 @@ See `defclass' for more information." (setf (eieio--class-children newc) children) (remhash cname eieio-defclass-autoload-map)))) - (if pname + (if superclasses (progn - (dolist (p pname) + (dolist (p superclasses) (if (not (and p (symbolp p))) (error "Invalid parent class %S" p) (let ((c (eieio--class-v p))) @@ -396,7 +396,7 @@ See `defclass' for more information." ;; Before adding new slots, let's add all the methods and classes ;; in from the parent class. - (eieio-copy-parents-into-subclass newc superclasses) + (eieio-copy-parents-into-subclass newc) ;; Store the new class vector definition into the symbol. We need to ;; do this first so that we can call defmethod for the accessor. @@ -784,7 +784,7 @@ if default value is nil." )) )) -(defun eieio-copy-parents-into-subclass (newc _parents) +(defun eieio-copy-parents-into-subclass (newc) "Copy into NEWC the slots of PARENTS. Follow the rules of not overwriting early parents when applying to the new child class." @@ -911,7 +911,7 @@ Argument FN is the function calling this verifier." (if (eieio--class-p c) (eieio-class-un-autoload obj)) c)) (t (eieio--object-class-object obj)))) - (c (eieio--slot-name-index class obj slot))) + (c (eieio--slot-name-index class slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. ;; Let's check that info out. @@ -935,7 +935,7 @@ Fills in OBJ's SLOT with its default value." (cl-check-type slot symbol) (let* ((cl (cond ((symbolp obj) (eieio--class-v obj)) (t (eieio--object-class-object obj)))) - (c (eieio--slot-name-index cl obj slot))) + (c (eieio--slot-name-index cl slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. ;; Let's check that info out. @@ -973,7 +973,7 @@ Fills in OBJ's SLOT with VALUE." (cl-check-type obj eieio-object) (cl-check-type slot symbol) (let* ((class (eieio--object-class-object obj)) - (c (eieio--slot-name-index class obj slot))) + (c (eieio--slot-name-index class slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. ;; Let's check that info out. @@ -997,7 +997,7 @@ Fills in the default value in CLASS' in SLOT with VALUE." (setq class (eieio--class-object class)) (cl-check-type class eieio--class) (cl-check-type slot symbol) - (let* ((c (eieio--slot-name-index class nil slot))) + (let* ((c (eieio--slot-name-index class slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. ;; Let's check that info out. @@ -1021,12 +1021,9 @@ Fills in the default value in CLASS' in SLOT with VALUE." ;;; EIEIO internal search functions ;; -(defun eieio--slot-name-index (class obj slot) - "In CLASS for OBJ find the index of the named SLOT. -The slot is a symbol which is installed in CLASS by the `defclass' -call. OBJ can be nil, but if it is an object, and the slot in question -is protected, access will be allowed if OBJ is a child of the currently -scoped class. +(defun eieio--slot-name-index (class slot) + "In CLASS find the index of the named SLOT. +The slot is a symbol which is installed in CLASS by the `defclass' call. If SLOT is the value created with :initarg instead, reverse-lookup that name, and recurse with the associated slot value." ;; Removed checks to outside this call @@ -1035,7 +1032,7 @@ reverse-lookup that name, and recurse with the associated slot value." (if (integerp fsi) (+ (eval-when-compile eieio--object-num-slots) fsi) (let ((fn (eieio--initarg-to-attribute class slot))) - (if fn (eieio--slot-name-index class obj fn) nil))))) + (if fn (eieio--slot-name-index class fn) nil))))) (defun eieio--class-slot-name-index (class slot) "In CLASS find the index of the named SLOT. @@ -1255,7 +1252,7 @@ method invocation orders of the involved classes." (eieio--class-precedence-list tag)))) -;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "b568ffb3c90ed5d0ae673f0051d608ee") +;;;### (autoloads nil "eieio-compat" "eieio-compat.el" "5b04c9a8fff2bd3f3d3ac54aba0f65b7") ;;; Generated autoloads from eieio-compat.el (autoload 'eieio--defalias "eieio-compat" "\ commit ad5a7c86d017ce8e9ff1312331ef09181be823bf Author: Stefan Monnier Date: Thu Feb 5 14:28:16 2015 -0500 Add (:documentation
) for dynamically-generated docstrings * lisp/emacs-lisp/bytecomp.el: (byte-compile-initial-macro-environment): Use macroexp-progn. (byte-compile-cl-warn): Don't silence use of cl-macroexpand-all. (byte-compile-file-form-defvar-function): Rename from byte-compile-file-form-define-abbrev-table. (defvaralias, byte-compile-file-form-custom-declare-variable): Use it. (byte-compile): Use byte-compile-top-level rather than byte-compile-lambda so we can compile non-values. (byte-compile-form): Add warnings for failed uses of lexical vars via quoted symbols. (byte-compile-unfold-bcf): Improve message for failed inlining. (byte-compile-make-closure): Handle new format of internal-make-closure for dynamically-generated docstrings. * lisp/emacs-lisp/cconv.el (cconv--convert-function): Add `docstring' argument. (cconv-convert): Use it to handle the new (:documentation ...) form. (cconv-analyze-form): Handle the new (:documentation ...) form. * src/eval.c (Ffunction): Handle the new (:documentation ...) form. (syms_of_eval): Declare `:documentation'. diff --git a/etc/NEWS b/etc/NEWS index 72e2356..d72d01f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -599,6 +599,10 @@ in languages like German where downcasing rules depend on grammar. * Lisp Changes in Emacs 25.1 +** lexical closures can use (:documentation ) to build their docstring. +It should be placed right where the docstring would be, and is then +evaluated (and should return a string) when the closure is built. + ** define-inline provides a new way to define inlinable functions. ** New function macroexpand-1 to perform a single step of macroexpansion. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 694a35b..51e944c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,24 @@ 2015-02-05 Stefan Monnier + * emacs-lisp/cconv.el (cconv--convert-function): + Add `docstring' argument. + (cconv-convert): Use it to handle the new (:documentation ...) form. + (cconv-analyze-form): Handle the new (:documentation ...) form. + + * emacs-lisp/bytecomp.el: + (byte-compile-initial-macro-environment): Use macroexp-progn. + (byte-compile-cl-warn): Don't silence use of cl-macroexpand-all. + (byte-compile-file-form-defvar-function): Rename from + byte-compile-file-form-define-abbrev-table. + (defvaralias, byte-compile-file-form-custom-declare-variable): Use it. + (byte-compile): Use byte-compile-top-level rather than + byte-compile-lambda so we can compile non-values. + (byte-compile-form): Add warnings for failed uses of lexical vars via + quoted symbols. + (byte-compile-unfold-bcf): Improve message for failed inlining. + (byte-compile-make-closure): Handle new format of internal-make-closure + for dynamically-generated docstrings. + * delsel.el: Deprecate the `kill' option. Use lexical-binding. (open-line): Delete like all other commands, instead of killing. (delete-active-region): Don't define any return any value. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 2bd8d07..548aaa9 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -31,6 +31,10 @@ ;; faster. [`LAP' == `Lisp Assembly Program'.] ;; The user entry points are byte-compile-file and byte-recompile-directory. +;;; Todo: + +;; - Turn "not bound at runtime" functions into autoloads. + ;;; Code: ;; ======================================================================== @@ -450,7 +454,7 @@ Return the compile-time value of FORM." (eval-when-compile . ,(lambda (&rest body) (let ((result nil)) (byte-compile-recurse-toplevel - (cons 'progn body) + (macroexp-progn body) (lambda (form) (setf result (byte-compile-eval @@ -459,7 +463,7 @@ Return the compile-time value of FORM." (list 'quote result)))) (eval-and-compile . ,(lambda (&rest body) (byte-compile-recurse-toplevel - (cons 'progn body) + (macroexp-progn body) (lambda (form) ;; Don't compile here, since we don't know ;; whether to compile as byte-compile-form @@ -1458,7 +1462,7 @@ extra args." ;; These would sometimes be warned about ;; but such warnings are never useful, ;; so don't warn about them. - macroexpand cl-macroexpand-all + macroexpand cl--compiling-file)))) (byte-compile-warn "function `%s' from cl package called at runtime" func))) @@ -2319,10 +2323,12 @@ list that represents a doc string reference. form)) (put 'define-abbrev-table 'byte-hunk-handler - 'byte-compile-file-form-define-abbrev-table) -(defun byte-compile-file-form-define-abbrev-table (form) - (if (eq 'quote (car-safe (car-safe (cdr form)))) - (byte-compile--declare-var (car-safe (cdr (cadr form))))) + 'byte-compile-file-form-defvar-function) +(put 'defvaralias 'byte-hunk-handler 'byte-compile-file-form-defvar-function) + +(defun byte-compile-file-form-defvar-function (form) + (pcase-let (((or `',name (let name nil)) (nth 1 form))) + (if name (byte-compile--declare-var name))) (byte-compile-keep-pending form)) (put 'custom-declare-variable 'byte-hunk-handler @@ -2330,8 +2336,7 @@ list that represents a doc string reference. (defun byte-compile-file-form-custom-declare-variable (form) (when (byte-compile-warning-enabled-p 'callargs) (byte-compile-nogroup-warn form)) - (byte-compile--declare-var (nth 1 (nth 1 form))) - (byte-compile-keep-pending form)) + (byte-compile-file-form-defvar-function form)) (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) (defun byte-compile-file-form-require (form) @@ -2580,17 +2585,11 @@ If FORM is a lambda or a macro, byte-compile it as a function." fun) (t (when (symbolp form) - (unless (memq (car-safe fun) '(closure lambda)) - (error "Don't know how to compile %S" fun)) (setq lexical-binding (eq (car fun) 'closure)) (setq fun (byte-compile--reify-function fun))) - (unless (eq (car-safe fun) 'lambda) - (error "Don't know how to compile %S" fun)) ;; Expand macros. (setq fun (byte-compile-preprocess fun)) - ;; Get rid of the `function' quote added by the `lambda' macro. - (if (eq (car-safe fun) 'function) (setq fun (cadr fun))) - (setq fun (byte-compile-lambda fun)) + (setq fun (byte-compile-top-level fun nil 'eval)) (if macro (push 'macro fun)) (if (symbolp form) (fset form fun) @@ -2966,6 +2965,16 @@ for symbols generated by the byte compiler itself." (interactive-only (or (get fn 'interactive-only) (memq fn byte-compile-interactive-only-functions)))) + (when (memq fn '(set symbol-value run-hooks ;; add-to-list + add-hook remove-hook run-hook-with-args + run-hook-with-args-until-success + run-hook-with-args-until-failure)) + (pcase (cdr form) + (`(',var . ,_) + (when (assq var byte-compile-lexical-variables) + (byte-compile-log-warning + (format "%s cannot use lexical var `%s'" fn var) + nil :error))))) (when (macroexp--const-symbol-p fn) (byte-compile-warn "`%s' called as a function" fn)) (when (and (byte-compile-warning-enabled-p 'interactive-only) @@ -3079,8 +3088,9 @@ for symbols generated by the byte compiler itself." (dotimes (_ (- (/ (1+ fmax2) 2) alen)) (byte-compile-push-constant nil))) ((zerop (logand fmax2 1)) - (byte-compile-log-warning "Too many arguments for inlined function" - nil :error) + (byte-compile-log-warning + (format "Too many arguments for inlined function %S" form) + nil :error) (byte-compile-discard (- alen (/ fmax2 2)))) (t ;; Turn &rest args into a list. @@ -3453,15 +3463,22 @@ discarding." (if byte-compile--for-effect (setq byte-compile--for-effect nil) (let* ((vars (nth 1 form)) (env (nth 2 form)) - (body (nthcdr 3 form)) + (docstring-exp (nth 3 form)) + (body (nthcdr 4 form)) (fun (byte-compile-lambda `(lambda ,vars . ,body) nil (length env)))) - (cl-assert (> (length env) 0)) ;Otherwise, we don't need a closure. + (cl-assert (or (> (length env) 0) + docstring-exp)) ;Otherwise, we don't need a closure. (cl-assert (byte-code-function-p fun)) (byte-compile-form `(make-byte-code ',(aref fun 0) ',(aref fun 1) (vconcat (vector . ,env) ',(aref fun 2)) - ,@(nthcdr 3 (mapcar (lambda (x) `',x) fun))))))) + ,@(let ((rest (nthcdr 3 (mapcar (lambda (x) `',x) fun)))) + (if docstring-exp + `(,(car rest) + ,docstring-exp + ,@(cddr rest)) + rest))))))) (defun byte-compile-get-closed-var (form) "Byte-compile the special `internal-get-closed-var' form." diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index e9d33e6..fa82407 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -48,7 +48,7 @@ ;; if the function is suitable for lambda lifting (if all calls are known) ;; ;; (lambda (v0 ...) ... fv0 .. fv1 ...) => -;; (internal-make-closure (v0 ...) (fv1 ...) +;; (internal-make-closure (v0 ...) (fv0 ...) ;; ... (internal-get-closed-var 0) ... (internal-get-closed-var 1) ...) ;; ;; If the function has no free variables, we don't do anything. @@ -65,6 +65,14 @@ ;; ;;; Code: +;; PROBLEM cases found during conversion to lexical binding. +;; We should try and detect and warn about those cases, even +;; for lexical-binding==nil to help prepare the migration. +;; - Uses of run-hooks, and friends. +;; - Cases where we want to apply the same code to different vars depending on +;; some test. These sometimes use a (let ((foo (if bar 'a 'b))) +;; ... (symbol-value foo) ... (set foo ...)). + ;; TODO: (not just for cconv but also for the lexbind changes in general) ;; - let (e)debug find the value of lexical variables from the stack. ;; - make eval-region do the eval-sexp-add-defvars dance. @@ -87,9 +95,8 @@ ;; the bytecomp only compiles it once. ;; - Since we know here when a variable is not mutated, we could pass that ;; info to the byte-compiler, e.g. by using a new `immutable-let'. -;; - add tail-calls to bytecode.c and the byte compiler. ;; - call known non-escaping functions with `goto' rather than `call'. -;; - optimize mapcar to a while loop. +;; - optimize mapc to a dolist loop. ;; (defmacro dlet (binders &rest body) ;; ;; Works in both lexical and non-lexical mode. @@ -195,7 +202,7 @@ Returns a form where all lambdas don't have any free variables." (unless (memq (car b) s) (push b res))) (nreverse res))) -(defun cconv--convert-function (args body env parentform) +(defun cconv--convert-function (args body env parentform &optional docstring) (cl-assert (equal body (caar cconv-freevars-alist))) (let* ((fvs (cdr (pop cconv-freevars-alist))) (body-new '()) @@ -240,11 +247,11 @@ Returns a form where all lambdas don't have any free variables." `(,@(nreverse special-forms) (let ,letbind . ,body-new))))) (cond - ((null envector) ;if no freevars - do nothing + ((not (or envector docstring)) ;If no freevars - do nothing. `(function (lambda ,args . ,body-new))) (t `(internal-make-closure - ,args ,envector . ,body-new))))) + ,args ,envector ,docstring . ,body-new))))) (defun cconv-convert (form env extend) ;; This function actually rewrites the tree. @@ -407,7 +414,9 @@ places where they originally did not directly appear." cond-forms))) (`(function (lambda ,args . ,body) . ,_) - (cconv--convert-function args body env form)) + (let ((docstring (if (eq :documentation (car-safe (car body))) + (cconv-convert (cadr (pop body)) env extend)))) + (cconv--convert-function args body env form docstring))) (`(internal-make-closure . ,_) (byte-compile-report-error @@ -533,7 +542,7 @@ FORM is the parent form that binds this var." ;; use = `(,binder ,read ,mutated ,captured ,called) (pcase vardata (`(,_ nil nil nil nil) nil) - (`((,(and (pred (lambda (var) (eq ?_ (aref (symbol-name var) 0)))) var) . ,_) + (`((,(and var (guard (eq ?_ (aref (symbol-name var) 0)))) . ,_) ,_ ,_ ,_ ,_) (byte-compile-log-warning (format "%s `%S' not left unused" varkind var)))) @@ -643,6 +652,8 @@ and updates the data stored in ENV." (cconv--analyze-use vardata form "variable")))) (`(function (lambda ,vrs . ,body-forms)) + (when (eq :documentation (car-safe (car body-forms))) + (cconv-analyze-form (cadr (pop body-forms)) env)) (cconv--analyze-function vrs body-forms env form)) (`(setq . ,forms) @@ -665,6 +676,10 @@ and updates the data stored in ENV." (dolist (forms cond-forms) (dolist (form forms) (cconv-analyze-form form env)))) + ;; ((and `(quote ,v . ,_) (guard (assq v env))) + ;; (byte-compile-log-warning + ;; (format "Possible confusion variable/symbol for `%S'" v))) + (`(quote . ,_) nil) ; quote form (`(function . ,_) nil) ; same as quote diff --git a/src/ChangeLog b/src/ChangeLog index 2c9b6c8..15d8d27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Stefan Monnier + + * eval.c (Ffunction): Handle the new (:documentation ...) form. + (syms_of_eval): Declare `:documentation'. + 2015-02-05 Martin Rudalics * xdisp.c (Fwindow_text_pixel_size): Remove optional BUFFER diff --git a/src/eval.c b/src/eval.c index b98b224..e828da9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -575,10 +575,23 @@ usage: (function ARG) */) if (!NILP (Vinternal_interpreter_environment) && CONSP (quoted) && EQ (XCAR (quoted), Qlambda)) - /* This is a lambda expression within a lexical environment; - return an interpreted closure instead of a simple lambda. */ - return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, - XCDR (quoted))); + { /* This is a lambda expression within a lexical environment; + return an interpreted closure instead of a simple lambda. */ + Lisp_Object cdr = XCDR (quoted); + Lisp_Object tmp = cdr; + if (CONSP (tmp) + && (tmp = XCDR (tmp), CONSP (tmp)) + && (tmp = XCAR (tmp), CONSP (tmp)) + && (EQ (QCdocumentation, XCAR (tmp)))) + { /* Handle the special (:documentation ) to build the docstring + dynamically. */ + Lisp_Object docstring = eval_sub (Fcar (XCDR (tmp))); + CHECK_STRING (docstring); + cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr)))); + } + return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, + cdr)); + } else /* Simply quote the argument. */ return quoted; @@ -3668,6 +3681,7 @@ before making `inhibit-quit' nil. */); DEFSYM (Qand_rest, "&rest"); DEFSYM (Qand_optional, "&optional"); DEFSYM (Qclosure, "closure"); + DEFSYM (QCdocumentation, ":documentation"); DEFSYM (Qdebug, "debug"); DEFVAR_LISP ("inhibit-debugger", Vinhibit_debugger, commit 55eb72816b32f5a869e843036fb122065c1ed56f Author: Artur Malabarba Date: Thu Feb 5 15:28:04 2015 -0200 help-fns.el (describe-function-or-variable): New function on `C-h o' diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 694a35b..92026c7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2015-02-05 Kelly Dean + + * help-mode.el (help-xref-interned): Pass BUFFER and FRAME to + `describe-variable'. + + * help-fns.el (describe-function-or-variable): New function. + + * help.el (help-map): Bind `describe-function-or-variable' to o. + (help-for-help-internal): Document o key. + 2015-02-05 Stefan Monnier * delsel.el: Deprecate the `kill' option. Use lexical-binding. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index c0d6393..61e8d54 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -930,6 +930,37 @@ file-local variable.\n") ;;;###autoload +(defun describe-function-or-variable (symbol &optional buffer frame) + "Display the full documentation of the function or variable SYMBOL. +If SYMBOL is a variable and has a buffer-local value in BUFFER or FRAME +\(default to the current buffer and current frame), it is displayed along +with the global value." + (interactive + (let* ((v-or-f (variable-at-point)) + (found (symbolp v-or-f)) + (v-or-f (if found v-or-f (function-called-at-point))) + (found (or found v-or-f)) + (enable-recursive-minibuffers t) + val) + (setq val (completing-read (if found + (format + "Describe function or variable (default %s): " v-or-f) + "Describe function or variable: ") + obarray + (lambda (vv) + (or (fboundp vv) + (get vv 'variable-documentation) + (and (boundp vv) (not (keywordp vv))))) + t nil nil + (if found (symbol-name v-or-f)))) + (list (if (equal val "") + v-or-f (intern val))))) + (if (not (symbolp symbol)) (message "You didn't specify a function or variable") + (unless (buffer-live-p buffer) (setq buffer (current-buffer))) + (unless (frame-live-p frame) (setq frame (selected-frame))) + (help-xref-interned symbol buffer frame))) + +;;;###autoload (defun describe-syntax (&optional buffer) "Describe the syntax specifications in the syntax table of BUFFER. The descriptions are inserted in a help buffer, which is then displayed. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index c62ddc3..564362a 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -621,10 +621,13 @@ See `help-make-xrefs'." ;; Additional functions for (re-)creating types of help buffers. -(defun help-xref-interned (symbol) + +;;;###autoload +(defun help-xref-interned (symbol &optional buffer frame) "Follow a hyperlink which appeared to be an arbitrary interned SYMBOL. Both variable, function and face documentation are extracted into a single -help buffer." +help buffer. If SYMBOL is a variable, include buffer-local value for optional +BUFFER or FRAME." (with-current-buffer (help-buffer) ;; Push the previous item on the stack before clobbering the output buffer. (help-setup-xref nil nil) @@ -640,7 +643,7 @@ help buffer." (get symbol 'variable-documentation)) ;; Don't record the current entry in the stack. (setq help-xref-stack-item nil) - (describe-variable symbol)))) + (describe-variable symbol buffer frame)))) (cond (sdoc ;; We now have a help buffer on the variable. diff --git a/lisp/help.el b/lisp/help.el index bf72425..fb1719a 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -95,6 +95,7 @@ (define-key map "k" 'describe-key) (define-key map "l" 'view-lossage) (define-key map "m" 'describe-mode) + (define-key map "o" 'describe-function-or-variable) (define-key map "n" 'view-emacs-news) (define-key map "p" 'finder-by-keyword) (define-key map "P" 'describe-package) @@ -218,6 +219,7 @@ L LANG-ENV Describes a specific language environment, or RET for current. m Display documentation of current minor modes and current major mode, including their special commands. n Display news of recent Emacs changes. +o SYMBOL Display the given function or variable's documentation and value. p TOPIC Find packages matching a given topic keyword. P PACKAGE Describe the given Emacs Lisp package. r Display the Emacs manual in Info mode. commit 649e21fe2f593263db5ddce373cf8ef2150630d2 Author: Glenn Morris Date: Thu Feb 5 09:09:36 2015 -0800 * doc/misc/auth.texi (Multiple GMail accounts with Gnus): Markup fix. diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 1264400..bc22b67 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-05 Glenn Morris + + * auth.texi (Multiple GMail accounts with Gnus): Markup fix. + 2015-02-05 Teodor Zlatanov * auth.texi (Multiple GMail accounts with Gnus): Add FAQ. diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index d9145bc..7c0254a 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -247,8 +247,8 @@ names: Your netrc entries will then be: @example -machine gmail login account@gmail.com password "accountpassword" port imap -machine gmail2 login account2@gmail.com password "account2password" port imap +machine gmail login account@@gmail.com password "accountpassword" port imap +machine gmail2 login account2@@gmail.com password "account2password" port imap @end example @node Secret Service API commit 10927c1a0f39d527d9ea1fc4605a0ef400bdff4a Author: Stefan Monnier Date: Thu Feb 5 11:05:07 2015 -0500 * lisp/emulation/viper.el: A couple of docstring format tweaks diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index e41109a..bd03a87 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -961,11 +961,11 @@ Suffixes such as .el or .elc should be stripped." (defun viper-ESC (arg) "Emulate ESC key in Emacs. Prevents multiple escape keystrokes if viper-no-multiple-ESC is true. -If viper-no-multiple-ESC is 'twice double ESC would ding in vi-state. +If `viper-no-multiple-ESC' is `twice' double ESC would ding in vi-state. Other ESC sequences are emulated via the current Emacs's major mode keymap. This is more convenient on TTYs, since this won't block function keys such as up, down, etc. ESC will also will also work as -a Meta key in this case. When viper-no-multiple-ESC is nil, ESC works +a Meta key in this case. When `viper-no-multiple-ESC' is nil, ESC works as a Meta key and any number of multiple escapes are allowed." (interactive "P") (let (char) diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 179ae16..250c292 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -60,13 +60,13 @@ Full Vi compatibility is not recommended for power use of Viper." :group 'viper) (defcustom viper-no-multiple-ESC t - "If true, multiple ESC in Vi mode will cause bell to ring. -This is set to t on a windowing terminal and to 'twice on a dumb + "If non-nil, multiple ESC in Vi mode will cause bell to ring. +This is set to t on a windowing terminal and to `twice' on a dumb terminal (unless the user level is 1, 2, or 5). On a dumb terminal, this enables cursor keys and is generally more convenient, as terminals usually don't have a convenient Meta key. -Setting viper-no-multiple-ESC to nil will allow as many multiple ESC, -as is allowed by the major mode in effect." +Setting it to nil will allow as many multiple ESC, as is allowed by the +major mode in effect." :type 'boolean :group 'viper) commit ab51cc7dd6ce6199cf4fcef35ae85245d3670c51 Author: Stefan Monnier Date: Thu Feb 5 11:02:10 2015 -0500 * lisp/delsel.el: Deprecate the `kill' option. Use lexical-binding. (open-line): Delete like all other commands, instead of killing. (delete-active-region): Don't define any return any value. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 73f1552..694a35b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,13 +1,17 @@ 2015-02-05 Stefan Monnier + * delsel.el: Deprecate the `kill' option. Use lexical-binding. + (open-line): Delete like all other commands, instead of killing. + (delete-active-region): Don't define any return any value. + * progmodes/python.el: Try to preserve compatibility with Emacs-24. (python-mode): Don't assume eldoc-documentation-function has a non-nil default. 2015-02-04 Sam Steingold - * progmodes/python.el (python-indent-calculate-indentation): Avoid - the error when computing top-level indentation. + * progmodes/python.el (python-indent-calculate-indentation): + Avoid the error when computing top-level indentation. 2015-02-04 Stefan Monnier diff --git a/lisp/delsel.el b/lisp/delsel.el index e6bb3b9..740b603 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -1,4 +1,4 @@ -;;; delsel.el --- delete selection if you insert +;;; delsel.el --- delete selection if you insert -*- lexical-binding:t -*- ;; Copyright (C) 1992, 1997-1998, 2001-2015 Free Software Foundation, ;; Inc. @@ -35,16 +35,12 @@ ;; property on their symbols; commands which insert text but don't ;; have this property won't delete the selection. It can be one of ;; the values: -;; 'yank +;; `yank' ;; For commands which do a yank; ensures the region about to be ;; deleted isn't yanked. -;; 'supersede +;; `supersede' ;; Delete the active region and ignore the current command, ;; i.e. the command will just delete the region. -;; 'kill -;; `kill-region' is used on the selection, rather than -;; `delete-region'. (Text selected with the mouse will typically -;; be yankable anyhow.) ;; t ;; The normal case: delete the active region prior to executing ;; the command which will insert replacement text. @@ -93,8 +89,7 @@ If KILLP in not-nil, the active region is killed instead of deleted." (cons (current-buffer) (and (consp buffer-undo-list) (car buffer-undo-list))))) (t - (funcall region-extract-function 'delete-only))) - t) + (funcall region-extract-function 'delete-only)))) (defun delete-selection-repeat-replace-region (arg) "Repeat replacing text of highlighted region with typed text. @@ -167,7 +162,7 @@ With ARG, repeat that many times. `C-u' means until end of buffer." For commands which need to dynamically determine this behavior. FUNCTION should take no argument and return one of the above values or nil." (condition-case data - (cond ((eq type 'kill) + (cond ((eq type 'kill) ;Deprecated, backward compatibility. (delete-active-region t) (if (and overwrite-mode (eq this-command 'self-insert-command)) @@ -255,7 +250,7 @@ See `delete-selection-helper'." (put 'newline-and-indent 'delete-selection t) (put 'newline 'delete-selection t) (put 'electric-newline-and-maybe-indent 'delete-selection t) -(put 'open-line 'delete-selection 'kill) +(put 'open-line 'delete-selection t) ;; This is very useful for canceling a selection in the minibuffer without ;; aborting the minibuffer. commit 14500c83b8e4ea20efdc3ea32499d2fb2e0d9253 Author: Stefan Monnier Date: Thu Feb 5 10:26:57 2015 -0500 * lisp/doc-view.el: Add some comments about desktop support diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 0e63d37..b718f1d 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1685,6 +1685,9 @@ If BACKWARD is non-nil, jump to the previous match." ;; desktop.el integration (defun doc-view-desktop-save-buffer (_desktop-dirname) + ;; FIXME: This is wrong, since this info is per-window but we only do it once + ;; here for the buffer. IOW it should be saved via something like + ;; `window-persistent-parameters'. `((page . ,(doc-view-current-page)) (slice . ,(doc-view-current-slice)))) @@ -1695,8 +1698,13 @@ If BACKWARD is non-nil, jump to the previous match." (let ((page (cdr (assq 'page misc))) (slice (cdr (assq 'slice misc)))) (desktop-restore-file-buffer file name misc) + ;; FIXME: We need to run this code after displaying the buffer. (with-selected-window (or (get-buffer-window (current-buffer) 0) (selected-window)) + ;; FIXME: This should be done for all windows restored that show + ;; this buffer. Basically, the page/slice should be saved as + ;; window-parameters in the window-state(s) and then restoring this + ;; window-state should call us back (to interpret/use those parameters). (doc-view-goto-page page) (when slice (apply 'doc-view-set-slice slice))))) commit 49aa3a12ccf0ceea3961edaec9cd00dc6038fc79 Author: Martin Rudalics Date: Thu Feb 5 15:40:19 2015 +0100 Remove recently added BUFFER arg of `window-text-pixel-size'. * xdisp.c (Fwindow_text_pixel_size): Remove optional BUFFER argument added on 2015-02-01. * display.texi (Size of Displayed Text): Remove description of optional argument BUFFER of `window-text-pixel-size'. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index aa4d320..e928d19 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Martin Rudalics + + * display.texi (Size of Displayed Text): Remove description of + optional argument BUFFER of `window-text-pixel-size'. + 2015-02-01 Martin Rudalics * display.texi (Size of Displayed Text): Describe optional diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 10b17a3..b09b82a 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -1880,7 +1880,7 @@ displayed in a given window. This function is used by @code{fit-frame-to-buffer} (@pxref{Size and Position}) to make a window exactly as large as the text it contains. -@defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line buffer +@defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line This function returns the size of the text of @var{window}'s buffer in pixels. @var{window} must be a live window and defaults to the selected one. The return value is a cons of the maximum pixel-width of any text @@ -1919,13 +1919,6 @@ means to not include the height of the mode- or header-line of @code{mode-line} or @code{header-line}, include only the height of that line, if present, in the return value. If it is @code{t}, include the height of both, if present, in the return value. - -The optional argument @var{buffer} allows to specify an alternate buffer -whose text size will be calculated. If @var{buffer} is @code{nil} or -omitted, then operate on the buffer of @var{window}. If it is @code{t}, -then operate on the current buffer as if it were displayed in -@var{window}. If it specifies a live buffer, then operate on that -buffer as if it were displayed in @var{window}. @end defun diff --git a/src/ChangeLog b/src/ChangeLog index 6b56abb..2c9b6c8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2015-02-05 Martin Rudalics + + * xdisp.c (Fwindow_text_pixel_size): Remove optional BUFFER + argument added on 2015-02-01. + 2015-02-04 Paul Eggert Remove no-longer-used two_byte_p calculations diff --git a/src/xdisp.c b/src/xdisp.c index 3c928f7..5c3e641 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9650,7 +9650,7 @@ in_display_vector_p (struct it *it) && it->dpvec + it->current.dpvec_index != it->dpend); } -DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 7, 0, +DEFUN ("window-text-pixel-size", Fwindow_text_pixel_size, Swindow_text_pixel_size, 0, 6, 0, doc: /* Return the size of the text of WINDOW's buffer in pixels. WINDOW must be a live window and defaults to the selected one. The return value is a cons of the maximum pixel-width of any text line and @@ -9683,17 +9683,12 @@ Optional argument MODE-AND-HEADER-LINE nil or omitted means do not include the height of the mode- or header-line of WINDOW in the return value. If it is either the symbol `mode-line' or `header-line', include only the height of that line, if present, in the return value. If t, -include the height of both, if present, in the return value. - -Optional argument BUFFER nil means to return the size of the text of -WINDOW's buffer. BUFFER t means to return the size of the text of the -current buffer as if it were displayed in WINDOW. Else BUFFER has to -specify a live buffer and this function returns the size of the text of -BUFFER as if it were displayed in WINDOW. */) +include the height of both, if present, in the return value. */) (Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit, - Lisp_Object y_limit, Lisp_Object mode_and_header_line, Lisp_Object buffer) + Lisp_Object y_limit, Lisp_Object mode_and_header_line) { struct window *w = decode_live_window (window); + Lisp_Object buffer = w->contents; struct buffer *b; struct it it; struct buffer *old_b = NULL; @@ -9702,23 +9697,13 @@ BUFFER as if it were displayed in WINDOW. */) void *itdata = NULL; int c, max_y = -1, x = 0, y = 0; - if (EQ (buffer, Qt)) - b = current_buffer; - else - { - if (NILP (buffer)) - buffer = w->contents; - - CHECK_BUFFER (buffer); - if (!BUFFER_LIVE_P (XBUFFER (buffer))) - error ("Not a live buffer"); + CHECK_BUFFER (buffer); + b = XBUFFER (buffer); - b = XBUFFER (buffer); - if (b != current_buffer) - { - old_b = current_buffer; - set_buffer_internal (b); - } + if (b != current_buffer) + { + old_b = current_buffer; + set_buffer_internal (b); } if (NILP (from)) commit ff7072d5314768e31a4f15ad1ce0039405ddb535 Author: Ted Zlatanov Date: Thu Feb 5 11:51:07 2015 +0000 lisp/gnus/gnus-start.el: always check newsrc timestamp when saving it diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 19bf562..32d3f08 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,9 @@ +2015-02-05 Teodor Zlatanov + + * gnus-start.el (gnus-save-newsrc-file-check-timestamp): Remove + variable; always check the newrc timestamp. + (gnus-save-newsrc-file): Always check timestamp. + 2015-02-05 Timo Lilja (tiny change) * mail-source.el (mail-source-call-script): If scripts exit with an diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index aa2568d..0c0246a 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -442,15 +442,6 @@ See also `gnus-before-startup-hook'." :group 'gnus-newsrc :type 'hook) -(defcustom gnus-save-newsrc-file-check-timestamp nil - "Check the modification time of the newsrc.eld file before saving it. -When the newsrc.eld file is updated by multiple machines, -checking the file's modification time is a good way to avoid -overwriting updated data." - :version "25.1" - :group 'gnus-newsrc - :type 'boolean) - (defcustom gnus-save-newsrc-hook nil "A hook called before saving any of the newsrc files." :group 'gnus-newsrc @@ -2833,19 +2824,18 @@ If FORCE is non-nil, the .newsrc file is read." ;; check timestamp of `gnus-current-startup-file'.eld against ;; `gnus-save-newsrc-file-last-timestamp' - (when gnus-save-newsrc-file-check-timestamp - (let* ((checkfile (concat gnus-current-startup-file ".eld")) - (mtime (nth 5 (file-attributes checkfile)))) - (when (and gnus-save-newsrc-file-last-timestamp - (time-less-p gnus-save-newsrc-file-last-timestamp - mtime)) - (unless (y-or-n-p - (format "%s was updated externally after %s, save?" - checkfile - (format-time-string - "%c" - gnus-save-newsrc-file-last-timestamp))) - (error "Couldn't save %s: updated externally" checkfile))))) + (let* ((checkfile (concat gnus-current-startup-file ".eld")) + (mtime (nth 5 (file-attributes checkfile)))) + (when (and gnus-save-newsrc-file-last-timestamp + (time-less-p gnus-save-newsrc-file-last-timestamp + mtime)) + (unless (y-or-n-p + (format "%s was updated externally after %s, save?" + checkfile + (format-time-string + "%c" + gnus-save-newsrc-file-last-timestamp))) + (error "Couldn't save %s: updated externally" checkfile)))) (if gnus-save-startup-file-via-temp-buffer (let ((coding-system-for-write gnus-ding-file-coding-system) commit ca25231a264d0c8dead443ab75c2edb02161cff9 Author: Ted Zlatanov Date: Thu Feb 5 11:50:17 2015 +0000 doc/misc/auth.texi (Multiple GMail accounts with Gnus): Add FAQ diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 82a74cb..1264400 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-05 Teodor Zlatanov + + * auth.texi (Multiple GMail accounts with Gnus): Add FAQ. + 2015-02-05 Lars Ingebrigtsen * gnus.texi (Using IMAP): Fix menu node name. diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index 44fcad8..d9145bc 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -59,6 +59,7 @@ It is a way for multiple applications to share a single configuration @menu * Overview:: Overview of the auth-source library. * Help for users:: +* Multiple GMail accounts with Gnus:: * Secret Service API:: * Help for developers:: * GnuPG and EasyPG Assistant Configuration:: @@ -229,6 +230,27 @@ don't use a port entry, you match any Tramp method, as explained earlier. Since Tramp has about 88 connection methods, this may be necessary if you have an unusual (see earlier comment on those) setup. +@node Multiple GMail accounts with Gnus +@chapter Multiple GMail accounts with Gnus + +For multiple GMail accounts with Gnus, you have to make two nnimap +entries in your @code{gnus-secondary-select-methods} with distinct +names: + +@example +(setq gnus-secondary-select-methods '((nnimap "gmail" + (nnimap-address "imap.gmail.com")) + (nnimap "gmail2" + (nnimap-address "imap.gmail.com")))) +@end example + +Your netrc entries will then be: + +@example +machine gmail login account@gmail.com password "accountpassword" port imap +machine gmail2 login account2@gmail.com password "account2password" port imap +@end example + @node Secret Service API @chapter Secret Service API