------------------------------------------------------------ revno: 117449 committer: Fabi?n Ezequiel Gallina branch nick: trunk timestamp: Mon 2014-06-30 01:54:46 -0300 message: * lisp/emacs-lisp/subr-x.el (string-reverse): Use `reverse'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-30 04:11:43 +0000 +++ lisp/ChangeLog 2014-06-30 04:54:46 +0000 @@ -1,5 +1,9 @@ 2014-06-30 Fabián Ezequiel Gallina + * emacs-lisp/subr-x.el (string-reverse): Use `reverse'. + +2014-06-30 Fabián Ezequiel Gallina + New if-let, when-let, thread-first and thread-last macros. * emacs-lisp/subr-x.el === modified file 'lisp/emacs-lisp/subr-x.el' --- lisp/emacs-lisp/subr-x.el 2014-06-30 04:11:43 +0000 +++ lisp/emacs-lisp/subr-x.el 2014-06-30 04:54:46 +0000 @@ -161,7 +161,7 @@ (defsubst string-reverse (str) "Reverse the string STR." - (apply 'string (nreverse (string-to-list str)))) + (reverse str)) (defsubst string-trim-left (string) "Remove leading whitespace from STRING." ------------------------------------------------------------ revno: 117448 committer: Fabi?n Ezequiel Gallina branch nick: trunk timestamp: Mon 2014-06-30 01:11:43 -0300 message: New if-let, when-let, thread-first and thread-last macros. * lisp/emacs-lisp/subr-x.el (internal--listify, internal--check-binding) (internal--build-binding-value-form, internal--build-binding) (internal--build-bindings): New functions. (internal--thread-argument, thread-first, thread-last) (if-let, when-let): New macros. * test/automated/subr-x-tests.el (subr-x-test-if-let-single-binding-expansion) (subr-x-test-if-let-single-symbol-expansion) (subr-x-test-if-let-nil-related-expansion) (subr-x-test-if-let-malformed-binding, subr-x-test-if-let-true) (subr-x-test-if-let-false, subr-x-test-if-let-bound-references) (subr-x-test-if-let-and-lazyness-is-preserved) (subr-x-test-when-let-body-expansion) (subr-x-test-when-let-single-binding-expansion) (subr-x-test-when-let-single-symbol-expansion) (subr-x-test-when-let-nil-related-expansion) (subr-x-test-when-let-malformed-binding) (subr-x-test-when-let-true, subr-x-test-when-let-false) (subr-x-test-when-let-bound-references) (subr-x-test-when-let-and-lazyness-is-preserved) (subr-x-test-thread-first-no-forms) (subr-x-test-thread-first-function-names-are-threaded) (subr-x-test-thread-first-expansion) (subr-x-test-thread-last-no-forms) (subr-x-test-thread-last-function-names-are-threaded) (subr-x-test-thread-last-expansion): New tests. diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-06-26 06:21:55 +0000 +++ etc/NEWS 2014-06-30 04:11:43 +0000 @@ -178,6 +178,14 @@ ** Functions `rmail-delete-forward' and `rmail-delete-backward' take an optional repeat-count argument. +--- +** New macros `if-let' and `when-let' allow defining bindings and to + execute code depending whether all values are a true. + +--- +** New macros `thread-first' and `thread-last' allow threading a form + as the first or last argument of subsequent forms. + * Changes in Emacs 24.5 on Non-Free Operating Systems === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-30 02:55:14 +0000 +++ lisp/ChangeLog 2014-06-30 04:11:43 +0000 @@ -1,3 +1,14 @@ +2014-06-30 Fabián Ezequiel Gallina + + New if-let, when-let, thread-first and thread-last macros. + + * emacs-lisp/subr-x.el + (internal--listify, internal--check-binding) + (internal--build-binding-value-form, internal--build-binding) + (internal--build-bindings): New functions. + (internal--thread-argument, thread-first, thread-last) + (if-let, when-let): New macros. + 2014-06-30 Grégoire Jadi * net/rcirc.el (rcirc-buffer-process): Restore previous === modified file 'lisp/emacs-lisp/subr-x.el' --- lisp/emacs-lisp/subr-x.el 2014-02-10 01:34:22 +0000 +++ lisp/emacs-lisp/subr-x.el 2014-06-30 04:11:43 +0000 @@ -32,6 +32,113 @@ ;;; Code: +(require 'pcase) + + +(defmacro internal--thread-argument (first? &rest forms) + "Internal implementation for `thread-first' and `thread-last'. +When Argument FIRST? is non-nil argument is threaded first, else +last. FORMS are the expressions to be threaded." + (pcase forms + (`(,x (,f . ,args) . ,rest) + `(internal--thread-argument + ,first? ,(if first? `(,f ,x ,@args) `(,f ,@args ,x)) ,@rest)) + (`(,x ,f . ,rest) `(internal--thread-argument ,first? (,f ,x) ,@rest)) + (_ (car forms)))) + +(defmacro thread-first (&rest forms) + "Thread FORMS elements as the first argument of their succesor. +Example: + (thread-first + 5 + (+ 20) + (/ 25) + - + (+ 40)) +Is equivalent to: + (+ (- (/ (+ 5 20) 25)) 40) +Note how the single `-' got converted into a list before +threading." + (declare (indent 1) + (debug (form &rest [&or symbolp (sexp &rest form)]))) + `(internal--thread-argument t ,@forms)) + +(defmacro thread-last (&rest forms) + "Thread FORMS elements as the last argument of their succesor. +Example: + (thread-last + 5 + (+ 20) + (/ 25) + - + (+ 40)) +Is equivalent to: + (+ 40 (- (/ 25 (+ 20 5)))) +Note how the single `-' got converted into a list before +threading." + (declare (indent 1) (debug thread-first)) + `(internal--thread-argument nil ,@forms)) + +(defsubst internal--listify (elt) + "Wrap ELT in a list if it is not one." + (if (not (listp elt)) + (list elt) + elt)) + +(defsubst internal--check-binding (binding) + "Check BINDING is properly formed." + (when (> (length binding) 2) + (signal + 'error + (cons "`let' bindings can have only one value-form" binding))) + binding) + +(defsubst internal--build-binding-value-form (binding prev-var) + "Build the conditional value form for BINDING using PREV-VAR." + `(,(car binding) (and ,prev-var ,(cadr binding)))) + +(defun internal--build-binding (binding prev-var) + "Check and build a single BINDING with PREV-VAR." + (thread-first + binding + internal--listify + internal--check-binding + (internal--build-binding-value-form prev-var))) + +(defun internal--build-bindings (bindings) + "Check and build conditional value forms for BINDINGS." + (let ((prev-var t)) + (mapcar (lambda (binding) + (let ((binding (internal--build-binding binding prev-var))) + (setq prev-var (car binding)) + binding)) + bindings))) + +(defmacro if-let (bindings then &rest else) + "Process BINDINGS and if all values are non-nil eval THEN, else ELSE. +Argument BINDINGS is a list of tuples whose car is a symbol to be +bound and (optionally) used in THEN, and its cadr is a sexp to be +evaled to set symbol's value. In the special case you only want +to bind a single value, BINDINGS can just be a plain tuple." + (declare (indent 2) (debug ((&rest (symbolp form)) form body))) + (when (and (<= (length bindings) 2) + (not (listp (car bindings)))) + ;; Adjust the single binding case + (setq bindings (list bindings))) + `(let* ,(internal--build-bindings bindings) + (if ,(car (internal--listify (car (last bindings)))) + ,then + ,@else))) + +(defmacro when-let (bindings &rest body) + "Process BINDINGS and if all values are non-nil eval BODY. +Argument BINDINGS is a list of tuples whose car is a symbol to be +bound and (optionally) used in BODY, and its cadr is a sexp to be +evaled to set symbol's value. In the special case you only want +to bind a single value, BINDINGS can just be a plain tuple." + (declare (indent 1) (debug if-let)) + (list 'if-let bindings (macroexp-progn body))) + (defsubst hash-table-keys (hash-table) "Return a list of keys in HASH-TABLE." (let ((keys '())) === modified file 'test/ChangeLog' --- test/ChangeLog 2014-06-29 18:32:35 +0000 +++ test/ChangeLog 2014-06-30 04:11:43 +0000 @@ -1,3 +1,27 @@ +2014-06-30 Fabián Ezequiel Gallina + + * automated/subr-x-tests.el + (subr-x-test-if-let-single-binding-expansion) + (subr-x-test-if-let-single-symbol-expansion) + (subr-x-test-if-let-nil-related-expansion) + (subr-x-test-if-let-malformed-binding, subr-x-test-if-let-true) + (subr-x-test-if-let-false, subr-x-test-if-let-bound-references) + (subr-x-test-if-let-and-lazyness-is-preserved) + (subr-x-test-when-let-body-expansion) + (subr-x-test-when-let-single-binding-expansion) + (subr-x-test-when-let-single-symbol-expansion) + (subr-x-test-when-let-nil-related-expansion) + (subr-x-test-when-let-malformed-binding) + (subr-x-test-when-let-true, subr-x-test-when-let-false) + (subr-x-test-when-let-bound-references) + (subr-x-test-when-let-and-lazyness-is-preserved) + (subr-x-test-thread-first-no-forms) + (subr-x-test-thread-first-function-names-are-threaded) + (subr-x-test-thread-first-expansion) + (subr-x-test-thread-last-no-forms) + (subr-x-test-thread-last-function-names-are-threaded) + (subr-x-test-thread-last-expansion): New tests. + 2014-06-29 Michael Albinus * automated/tramp-tests.el (tramp--instrument-test-case): === added file 'test/automated/subr-x-tests.el' --- test/automated/subr-x-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/subr-x-tests.el 2014-06-30 04:11:43 +0000 @@ -0,0 +1,526 @@ +;;; subr-x-tests.el --- Testing the extended lisp routines + +;; Copyright (C) 2011-2014 Free Software Foundation, Inc. + +;; Author: Fabián E. Gallina +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'subr-x) + + +;; if-let tests + +(ert-deftest subr-x-test-if-let-single-binding-expansion () + "Test single bindings are expanded properly." + (should (equal + (macroexpand + '(if-let (a 1) + (- a) + "no")) + '(let* ((a (and t 1))) + (if a + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let (a) + (- a) + "no")) + '(let* ((a (and t nil))) + (if a + (- a) + "no"))))) + +(ert-deftest subr-x-test-if-let-single-symbol-expansion () + "Test single symbol bindings are expanded properly." + (should (equal + (macroexpand + '(if-let (a) + (- a) + "no")) + '(let* ((a (and t nil))) + (if a + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let (a b c) + (- a) + "no")) + '(let* ((a (and t nil)) + (b (and a nil)) + (c (and b nil))) + (if c + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let (a (b 2) c) + (- a) + "no")) + '(let* ((a (and t nil)) + (b (and a 2)) + (c (and b nil))) + (if c + (- a) + "no"))))) + +(ert-deftest subr-x-test-if-let-nil-related-expansion () + "Test nil is processed properly." + (should (equal + (macroexpand + '(if-let (nil) + (- a) + "no")) + '(let* ((nil (and t nil))) + (if nil + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let ((nil)) + (- a) + "no")) + '(let* ((nil (and t nil))) + (if nil + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let ((a 1) (nil) (b 2)) + (- a) + "no")) + '(let* ((a (and t 1)) + (nil (and a nil)) + (b (and nil 2))) + (if b + (- a) + "no")))) + (should (equal + (macroexpand + '(if-let ((a 1) nil (b 2)) + (- a) + "no")) + '(let* ((a (and t 1)) + (nil (and a nil)) + (b (and nil 2))) + (if b + (- a) + "no"))))) + +(ert-deftest subr-x-test-if-let-malformed-binding () + "Test malformed bindings trigger errors." + (should-error (macroexpand + '(if-let (_ (a 1 1) (b 2) (c 3) d) + (- a) + "no")) + :type 'error) + (should-error (macroexpand + '(if-let (_ (a 1) (b 2 2) (c 3) d) + (- a) + "no")) + :type 'error) + (should-error (macroexpand + '(if-let (_ (a 1) (b 2) (c 3 3) d) + (- a) + "no")) + :type 'error) + (should-error (macroexpand + '(if-let ((a 1 1)) + (- a) + "no")) + :type 'error)) + +(ert-deftest subr-x-test-if-let-true () + "Test `if-let' with truthy bindings." + (should (equal + (if-let (a 1) + a + "no") + 1)) + (should (equal + (if-let ((a 1) (b 2) (c 3)) + (list a b c) + "no") + (list 1 2 3)))) + +(ert-deftest subr-x-test-if-let-false () + "Test `if-let' with falsey bindings." + (should (equal + (if-let (a nil) + (list a b c) + "no") + "no")) + (should (equal + (if-let ((a nil) (b 2) (c 3)) + (list a b c) + "no") + "no")) + (should (equal + (if-let ((a 1) (b nil) (c 3)) + (list a b c) + "no") + "no")) + (should (equal + (if-let ((a 1) (b 2) (c nil)) + (list a b c) + "no") + "no")) + (should (equal + (if-let (z (a 1) (b 2) (c 3)) + (list a b c) + "no") + "no")) + (should (equal + (if-let ((a 1) (b 2) (c 3) d) + (list a b c) + "no") + "no"))) + +(ert-deftest subr-x-test-if-let-bound-references () + "Test `if-let' bindings can refer to already bound symbols." + (should (equal + (if-let ((a (1+ 0)) (b (1+ a)) (c (1+ b))) + (list a b c) + "no") + (list 1 2 3)))) + +(ert-deftest subr-x-test-if-let-and-lazyness-is-preserved () + "Test `if-let' respects `and' lazyness." + (let (a-called b-called c-called) + (should (equal + (if-let ((a nil) + (b (setq b-called t)) + (c (setq c-called t))) + "yes" + (list a-called b-called c-called)) + (list nil nil nil)))) + (let (a-called b-called c-called) + (should (equal + (if-let ((a (setq a-called t)) + (b nil) + (c (setq c-called t))) + "yes" + (list a-called b-called c-called)) + (list t nil nil)))) + (let (a-called b-called c-called) + (should (equal + (if-let ((a (setq a-called t)) + (b (setq b-called t)) + (c nil) + (d (setq c-called t))) + "yes" + (list a-called b-called c-called)) + (list t t nil))))) + + +;; when-let tests + +(ert-deftest subr-x-test-when-let-body-expansion () + "Test body allows for multiple sexps wrapping with progn." + (should (equal + (macroexpand + '(when-let (a 1) + (message "opposite") + (- a))) + '(let* ((a (and t 1))) + (if a + (progn + (message "opposite") + (- a))))))) + +(ert-deftest subr-x-test-when-let-single-binding-expansion () + "Test single bindings are expanded properly." + (should (equal + (macroexpand + '(when-let (a 1) + (- a))) + '(let* ((a (and t 1))) + (if a + (- a))))) + (should (equal + (macroexpand + '(when-let (a) + (- a))) + '(let* ((a (and t nil))) + (if a + (- a)))))) + +(ert-deftest subr-x-test-when-let-single-symbol-expansion () + "Test single symbol bindings are expanded properly." + (should (equal + (macroexpand + '(when-let (a) + (- a))) + '(let* ((a (and t nil))) + (if a + (- a))))) + (should (equal + (macroexpand + '(when-let (a b c) + (- a))) + '(let* ((a (and t nil)) + (b (and a nil)) + (c (and b nil))) + (if c + (- a))))) + (should (equal + (macroexpand + '(when-let (a (b 2) c) + (- a))) + '(let* ((a (and t nil)) + (b (and a 2)) + (c (and b nil))) + (if c + (- a)))))) + +(ert-deftest subr-x-test-when-let-nil-related-expansion () + "Test nil is processed properly." + (should (equal + (macroexpand + '(when-let (nil) + (- a))) + '(let* ((nil (and t nil))) + (if nil + (- a))))) + (should (equal + (macroexpand + '(when-let ((nil)) + (- a))) + '(let* ((nil (and t nil))) + (if nil + (- a))))) + (should (equal + (macroexpand + '(when-let ((a 1) (nil) (b 2)) + (- a))) + '(let* ((a (and t 1)) + (nil (and a nil)) + (b (and nil 2))) + (if b + (- a))))) + (should (equal + (macroexpand + '(when-let ((a 1) nil (b 2)) + (- a))) + '(let* ((a (and t 1)) + (nil (and a nil)) + (b (and nil 2))) + (if b + (- a)))))) + +(ert-deftest subr-x-test-when-let-malformed-binding () + "Test malformed bindings trigger errors." + (should-error (macroexpand + '(when-let (_ (a 1 1) (b 2) (c 3) d) + (- a))) + :type 'error) + (should-error (macroexpand + '(when-let (_ (a 1) (b 2 2) (c 3) d) + (- a))) + :type 'error) + (should-error (macroexpand + '(when-let (_ (a 1) (b 2) (c 3 3) d) + (- a))) + :type 'error) + (should-error (macroexpand + '(when-let ((a 1 1)) + (- a))) + :type 'error)) + +(ert-deftest subr-x-test-when-let-true () + "Test `when-let' with truthy bindings." + (should (equal + (when-let (a 1) + a) + 1)) + (should (equal + (when-let ((a 1) (b 2) (c 3)) + (list a b c)) + (list 1 2 3)))) + +(ert-deftest subr-x-test-when-let-false () + "Test `when-let' with falsey bindings." + (should (equal + (when-let (a nil) + (list a b c) + "no") + nil)) + (should (equal + (when-let ((a nil) (b 2) (c 3)) + (list a b c) + "no") + nil)) + (should (equal + (when-let ((a 1) (b nil) (c 3)) + (list a b c) + "no") + nil)) + (should (equal + (when-let ((a 1) (b 2) (c nil)) + (list a b c) + "no") + nil)) + (should (equal + (when-let (z (a 1) (b 2) (c 3)) + (list a b c) + "no") + nil)) + (should (equal + (when-let ((a 1) (b 2) (c 3) d) + (list a b c) + "no") + nil))) + +(ert-deftest subr-x-test-when-let-bound-references () + "Test `when-let' bindings can refer to already bound symbols." + (should (equal + (when-let ((a (1+ 0)) (b (1+ a)) (c (1+ b))) + (list a b c)) + (list 1 2 3)))) + +(ert-deftest subr-x-test-when-let-and-lazyness-is-preserved () + "Test `when-let' respects `and' lazyness." + (let (a-called b-called c-called) + (should (equal + (progn + (when-let ((a nil) + (b (setq b-called t)) + (c (setq c-called t))) + "yes") + (list a-called b-called c-called)) + (list nil nil nil)))) + (let (a-called b-called c-called) + (should (equal + (progn + (when-let ((a (setq a-called t)) + (b nil) + (c (setq c-called t))) + "yes") + (list a-called b-called c-called)) + (list t nil nil)))) + (let (a-called b-called c-called) + (should (equal + (progn + (when-let ((a (setq a-called t)) + (b (setq b-called t)) + (c nil) + (d (setq c-called t))) + "yes") + (list a-called b-called c-called)) + (list t t nil))))) + + +;; Thread first tests + +(ert-deftest subr-x-test-thread-first-no-forms () + "Test `thread-first' with no forms expands to the first form." + (should (equal (macroexpand '(thread-first 5)) 5)) + (should (equal (macroexpand '(thread-first (+ 1 2))) '(+ 1 2)))) + +(ert-deftest subr-x-test-thread-first-function-names-are-threaded () + "Test `thread-first' wraps single function names." + (should (equal (macroexpand + '(thread-first 5 + -)) + '(- 5))) + (should (equal (macroexpand + '(thread-first (+ 1 2) + -)) + '(- (+ 1 2))))) + +(ert-deftest subr-x-test-thread-first-expansion () + "Test `thread-first' expands correctly." + (should (equal + (macroexpand '(thread-first + 5 + (+ 20) + (/ 25) + - + (+ 40))) + '(+ (- (/ (+ 5 20) 25)) 40)))) + +(ert-deftest subr-x-test-thread-first-examples () + "Test several `thread-first' examples." + (should (equal (thread-first (+ 40 2)) 42)) + (should (equal (thread-first + 5 + (+ 20) + (/ 25) + - + (+ 40)) 39)) + (should (equal (thread-first + "this-is-a-string" + (split-string "-") + (nbutlast 2) + (append (list "good"))) + (list "this" "is" "good")))) + +;; Thread last tests + +(ert-deftest subr-x-test-thread-last-no-forms () + "Test `thread-last' with no forms expands to the first form." + (should (equal (macroexpand '(thread-last 5)) 5)) + (should (equal (macroexpand '(thread-last (+ 1 2))) '(+ 1 2)))) + +(ert-deftest subr-x-test-thread-last-function-names-are-threaded () + "Test `thread-last' wraps single function names." + (should (equal (macroexpand + '(thread-last 5 + -)) + '(- 5))) + (should (equal (macroexpand + '(thread-last (+ 1 2) + -)) + '(- (+ 1 2))))) + +(ert-deftest subr-x-test-thread-last-expansion () + "Test `thread-last' expands correctly." + (should (equal + (macroexpand '(thread-last + 5 + (+ 20) + (/ 25) + - + (+ 40))) + '(+ 40 (- (/ 25 (+ 20 5))))))) + +(ert-deftest subr-x-test-thread-last-examples () + "Test several `thread-last' examples." + (should (equal (thread-last (+ 40 2)) 42)) + (should (equal (thread-last + 5 + (+ 20) + (/ 25) + - + (+ 40)) 39)) + (should (equal (thread-last + (list 1 -2 3 -4 5) + (mapcar #'abs) + (cl-reduce #'+) + (format "abs sum is: %s")) + "abs sum is: 15"))) + + +(provide 'subr-x-tests) +;;; subr-x-tests.el ends here ------------------------------------------------------------ revno: 117447 fixes bug: http://debbugs.gnu.org/17772 author: Gr?goire Jadi committer: Leo Liu branch nick: trunk timestamp: Mon 2014-06-30 10:55:14 +0800 message: * net/rcirc.el (rcirc-buffer-process): Restore previous behaviour. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-29 11:26:47 +0000 +++ lisp/ChangeLog 2014-06-30 02:55:14 +0000 @@ -1,3 +1,8 @@ +2014-06-30 Grégoire Jadi + + * net/rcirc.el (rcirc-buffer-process): Restore previous + behaviour. (Bug#17772) + 2014-06-29 Alan Mackenzie Don't call c-parse-state when c++-template-syntax-table is active. === modified file 'lisp/net/rcirc.el' --- lisp/net/rcirc.el 2014-06-19 11:14:59 +0000 +++ lisp/net/rcirc.el 2014-06-30 02:55:14 +0000 @@ -802,11 +802,11 @@ (defun rcirc-buffer-process (&optional buffer) "Return the process associated with channel BUFFER. With no argument or nil as argument, use the current buffer." - (let ((buffer (or buffer (if (buffer-live-p rcirc-server-buffer) - rcirc-server-buffer - (error "Server buffer deleted"))))) - (or (with-current-buffer buffer rcirc-process) - rcirc-process))) + (let ((buffer (or buffer (and (buffer-live-p rcirc-server-buffer) + rcirc-server-buffer)))) + (if buffer + (with-current-buffer buffer rcirc-process) + rcirc-process))) (defun rcirc-server-name (process) "Return PROCESS server name, given by the 001 response." ------------------------------------------------------------ revno: 117446 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-06-29 17:01:51 -0700 message: * update_autogen: Find loaddefs targets rather than parsing lisp/Makefile.in * lisp/Makefile.in: Comment. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2014-06-29 01:33:32 +0000 +++ admin/ChangeLog 2014-06-30 00:01:51 +0000 @@ -1,3 +1,8 @@ +2014-06-30 Glenn Morris + + * update_autogen: Find loaddefs targets rather than + parsing lisp/Makefile.in + 2014-06-29 Glenn Morris * update_autogen: Remove need to cd into/out of lisp/. === modified file 'admin/update_autogen' --- admin/update_autogen 2014-06-29 01:33:32 +0000 +++ admin/update_autogen 2014-06-30 00:01:51 +0000 @@ -322,15 +322,19 @@ echo "Finding loaddef targets..." -sed -n -e '/^AUTOGEN_VCS/,/^$/p' lisp/Makefile.in | \ - sed -e '/AUTOGEN_VCS/d' -e '/^$/d' -e 's/\\//' \ - >| $tempfile || die "sed error" +find lisp -name '*.el' -exec grep '^;.*generated-autoload-file:' {} + | \ + sed -e '/loaddefs\|esh-groups/d' -e 's|/[^/]*: "|/|' -e 's/"//g' \ + >| $tempfile || die "Error finding targets" genfiles= while read genfile; do - genfile=lisp/$genfile + ## Or we can just use sort -u when making tempfile... + case " $genfiles " in + *" $genfile "*) continue ;; + esac + [ -r $genfile ] || die "Unable to read $genfile" genfiles="$genfiles $genfile" === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2014-06-28 01:26:09 +0000 +++ lisp/Makefile.in 2014-06-30 00:01:51 +0000 @@ -71,7 +71,6 @@ org/org-loaddefs.el # Versioned files that are the value of someone's `generated-autoload-file'. -# Note that update_loaddefs parses this. AUTOGEN_VCS = \ ps-print.el \ obsolete/tpu-edt.el \ ------------------------------------------------------------ revno: 117445 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-29 20:32:35 +0200 message: * automated/tramp-tests.el (tramp--instrument-test-case): Print debug buffer in any case. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-06-28 17:27:29 +0000 +++ test/ChangeLog 2014-06-29 18:32:35 +0000 @@ -1,3 +1,8 @@ +2014-06-29 Michael Albinus + + * automated/tramp-tests.el (tramp--instrument-test-case): + Print debug buffer in any case. + 2014-06-28 Leo Liu * automated/calc-tests.el: New file and add tests for math-bignum. === modified file 'test/automated/tramp-tests.el' --- test/automated/tramp-tests.el 2014-06-24 07:48:19 +0000 +++ test/automated/tramp-tests.el 2014-06-29 18:32:35 +0000 @@ -116,18 +116,15 @@ `(let ((tramp-verbose ,verbose) (tramp-message-show-message t) (tramp-debug-on-error t)) - (condition-case err + (unwind-protect (progn ,@body) - (ert-test-skipped - (signal (car err) (cdr err))) - ((error quit) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (with-current-buffer (tramp-get-connection-buffer v) - (message "%s" (buffer-string))) - (with-current-buffer (tramp-get-debug-buffer v) - (message "%s" (buffer-string)))) - (message "%s" err) - (signal (car err) (cdr err)))))) + (when (> tramp-verbose 3) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (with-current-buffer (tramp-get-connection-buffer v) + (message "%s" (buffer-string))) + (with-current-buffer + (tramp-get-debug-buffer v) + (message "%s" (buffer-string)))))))) (ert-deftest tramp-test00-availability () "Test availability of Tramp functions." ------------------------------------------------------------ revno: 117444 committer: Dmitry Antipov branch nick: trunk timestamp: Sun 2014-06-29 20:12:08 +0400 message: * xfns.c (Qsuppress_icon): Remove; no real users. (syms_of_xfns): Don't DEFSYM it. Remove ancient comments. * w32fns.c (Qsuppress_icon): Remove, for the same reason. (syms_of_w32fns): Don't DEFSYM it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-29 00:49:59 +0000 +++ src/ChangeLog 2014-06-29 16:12:08 +0000 @@ -1,3 +1,10 @@ +2014-06-29 Dmitry Antipov + + * xfns.c (Qsuppress_icon): Remove; no real users. + (syms_of_xfns): Don't DEFSYM it. Remove ancient comments. + * w32fns.c (Qsuppress_icon): Remove, for the same reason. + (syms_of_w32fns): Don't DEFSYM it. + 2014-06-29 Glenn Morris * Makefile.in (ns-app): Mark as PHONY. === modified file 'src/w32fns.c' --- src/w32fns.c 2014-06-22 23:12:17 +0000 +++ src/w32fns.c 2014-06-29 16:12:08 +0000 @@ -96,7 +96,6 @@ #define IDC_HAND MAKEINTRESOURCE(32649) #endif -Lisp_Object Qsuppress_icon; Lisp_Object Qundefined_color; Lisp_Object Qcancel_timer; Lisp_Object Qfont_param; @@ -8091,7 +8090,6 @@ w32_visible_system_caret_hwnd = NULL; - DEFSYM (Qsuppress_icon, "suppress-icon"); DEFSYM (Qundefined_color, "undefined-color"); DEFSYM (Qcancel_timer, "cancel-timer"); DEFSYM (Qhyper, "hyper"); @@ -8106,8 +8104,6 @@ DEFSYM (Qworkarea, "workarea"); DEFSYM (Qmm_size, "mm-size"); DEFSYM (Qframes, "frames"); - /* This is the end of symbol initialization. */ - Fput (Qundefined_color, Qerror_conditions, listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); === modified file 'src/xfns.c' --- src/xfns.c 2014-06-22 05:00:14 +0000 +++ src/xfns.c 2014-06-29 16:12:08 +0000 @@ -125,7 +125,6 @@ #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) -static Lisp_Object Qsuppress_icon; static Lisp_Object Qundefined_color; static Lisp_Object Qcompound_text, Qcancel_timer; Lisp_Object Qfont_param; @@ -6137,15 +6136,10 @@ void syms_of_xfns (void) { - /* The section below is built by the lisp expression at the top of the file, - just above where these variables are declared. */ - /*&&& init symbols here &&&*/ - DEFSYM (Qsuppress_icon, "suppress-icon"); DEFSYM (Qundefined_color, "undefined-color"); DEFSYM (Qcompound_text, "compound-text"); DEFSYM (Qcancel_timer, "cancel-timer"); DEFSYM (Qfont_param, "font-parameter"); - /* This is the end of symbol initialization. */ Fput (Qundefined_color, Qerror_conditions, listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror)); ------------------------------------------------------------ revno: 117443 committer: Alan Mackenzie branch nick: trunk timestamp: Sun 2014-06-29 11:26:47 +0000 message: Don't call c-parse-state when c++-template-syntax-table is active. * progmodes/cc-engine.el (c-guess-continued-construct CASE G) (c-guess-basic-syntax CASE 5D.3): Rearrange so that c-syntactic-skip-backwards isn't called with the pertinent syntax table. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-28 17:27:29 +0000 +++ lisp/ChangeLog 2014-06-29 11:26:47 +0000 @@ -1,3 +1,11 @@ +2014-06-29 Alan Mackenzie + + Don't call c-parse-state when c++-template-syntax-table is active. + * progmodes/cc-engine.el (c-guess-continued-construct CASE G) + (c-guess-basic-syntax CASE 5D.3): Rearrange so that + c-syntactic-skip-backwards isn't called with the pertinent syntax + table. + 2014-06-28 Stephen Berman * calendar/todo-mode.el (todo-set-top-priorities): Fix logic to === modified file 'lisp/progmodes/cc-defs.el' --- lisp/progmodes/cc-defs.el 2014-02-09 12:34:25 +0000 +++ lisp/progmodes/cc-defs.el 2014-06-29 11:26:47 +0000 @@ -823,6 +823,8 @@ (defmacro c-with-syntax-table (table &rest code) ;; Temporarily switches to the specified syntax table in a failsafe ;; way to execute code. + ;; Maintainers' note: If TABLE is `c++-template-syntax-table', DON'T call + ;; any forms inside this that call `c-parse-state'. !!!! `(let ((c-with-syntax-table-orig-table (syntax-table))) (unwind-protect (progn === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2014-05-30 17:06:53 +0000 +++ lisp/progmodes/cc-engine.el 2014-06-29 11:26:47 +0000 @@ -9355,16 +9355,16 @@ (not (looking-at c-<-op-cont-regexp)))))) (c-with-syntax-table c++-template-syntax-table (goto-char placeholder) - (c-beginning-of-statement-1 containing-sexp t) - (if (save-excursion - (c-backward-syntactic-ws containing-sexp) - (eq (char-before) ?<)) - ;; In a nested template arglist. - (progn - (goto-char placeholder) - (c-syntactic-skip-backward "^,;" containing-sexp t) - (c-forward-syntactic-ws)) - (back-to-indentation))) + (c-beginning-of-statement-1 containing-sexp t)) + (if (save-excursion + (c-backward-syntactic-ws containing-sexp) + (eq (char-before) ?<)) + ;; In a nested template arglist. + (progn + (goto-char placeholder) + (c-syntactic-skip-backward "^,;" containing-sexp t) + (c-forward-syntactic-ws)) + (back-to-indentation)) ;; FIXME: Should use c-add-stmt-syntax, but it's not yet ;; template aware. (c-add-syntax 'template-args-cont (point) placeholder)) @@ -10022,16 +10022,16 @@ (eq (char-after placeholder) ?<)))))) (c-with-syntax-table c++-template-syntax-table (goto-char placeholder) - (c-beginning-of-statement-1 lim t) - (if (save-excursion - (c-backward-syntactic-ws lim) - (eq (char-before) ?<)) - ;; In a nested template arglist. - (progn - (goto-char placeholder) - (c-syntactic-skip-backward "^,;" lim t) - (c-forward-syntactic-ws)) - (back-to-indentation))) + (c-beginning-of-statement-1 lim t)) + (if (save-excursion + (c-backward-syntactic-ws lim) + (eq (char-before) ?<)) + ;; In a nested template arglist. + (progn + (goto-char placeholder) + (c-syntactic-skip-backward "^,;" lim t) + (c-forward-syntactic-ws)) + (back-to-indentation)) ;; FIXME: Should use c-add-stmt-syntax, but it's not yet ;; template aware. (c-add-syntax 'template-args-cont (point) placeholder)) === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2014-06-14 23:54:39 +0000 +++ lisp/progmodes/cc-langs.el 2014-06-29 11:26:47 +0000 @@ -394,7 +394,9 @@ ;; lists are parsed. Note that this encourages incorrect parsing of ;; templates since they might contain normal operators that uses the ;; '<' and '>' characters. Therefore this syntax table might go - ;; away when CC Mode handles templates correctly everywhere. + ;; away when CC Mode handles templates correctly everywhere. WHILE + ;; THIS SYNTAX TABLE IS CURRENT, `c-parse-state' MUST _NOT_ BE + ;; CALLED!!! t nil (java c++) `(lambda () (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table)))) ------------------------------------------------------------ revno: 117442 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-06-28 18:33:32 -0700 message: * admin/update_autogen: Remove need to cd into/out of lisp/. diff: === modified file 'admin/ChangeLog' --- admin/ChangeLog 2014-06-29 00:46:40 +0000 +++ admin/ChangeLog 2014-06-29 01:33:32 +0000 @@ -1,5 +1,7 @@ 2014-06-29 Glenn Morris + * update_autogen: Remove need to cd into/out of lisp/. + * grammars/Makefile.in (bootstrap-clean): Don't delete Makefile, for sake of top-level maintainer-clean rule. === modified file 'admin/update_autogen' --- admin/update_autogen 2014-03-21 06:39:13 +0000 +++ admin/update_autogen 2014-06-29 01:33:32 +0000 @@ -330,7 +330,8 @@ while read genfile; do - [ -r lisp/$genfile ] || die "Unable to read $genfile" + genfile=lisp/$genfile + [ -r $genfile ] || die "Unable to read $genfile" genfiles="$genfiles $genfile" done < $tempfile @@ -369,18 +370,12 @@ cp $ldefs_in $ldefs_out || die "cp ldefs_boot error" -cd lisp - echo "Checking status of loaddef files..." ## It probably would be fine to just check+commit lisp/, since ## making autoloads should not effect any other files. But better ## safe than sorry. -modified=$(status $genfiles ${ldefs_out#lisp/}) || die - - -## bzr status output is always relative to top-level, not PWD. -[ "$vcs" = "bzr" ] && cd ../ +modified=$(status $genfiles $ldefs_out) || die commit "loaddefs" $modified || die "commit error"