------------------------------------------------------------ revno: 117133 committer: Leo Liu branch nick: trunk timestamp: Wed 2014-05-21 11:49:58 +0800 message: * doc/lispref/sequences.texi (Sequence Functions): Update nreverse. * src/fns.c (Fnreverse): Accept strings for SEQ and update doc-string. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-05-19 19:19:05 +0000 +++ doc/lispref/ChangeLog 2014-05-21 03:49:58 +0000 @@ -1,3 +1,7 @@ +2014-05-21 Leo Liu + + * sequences.texi (Sequence Functions): Update nreverse. + 2014-05-19 Paul Eggert Allow any non-nil value to count as true in bool-vector. === modified file 'doc/lispref/sequences.texi' --- doc/lispref/sequences.texi 2014-05-19 19:19:05 +0000 +++ doc/lispref/sequences.texi 2014-05-21 03:49:58 +0000 @@ -261,13 +261,16 @@ @end defun @defun nreverse seq +@cindex reversing a string @cindex reversing a list @cindex reversing a vector This function reverses the order of the elements of @var{seq}. -If @var{seq} is a list, @code{nreverse} alters its by reversing the @sc{cdr}s +If @var{seq} is a list, @code{nreverse} alters it by reversing the @sc{cdr}s in the cons cells. The cons cell that used to be the last one in @var{seq} becomes the first cons cell of the value. If @var{seq} is a vector or -bool vector, its items are placed in the same vector in a reversed order. +bool vector, its items are placed in the same vector in a reversed +order. If @var{seq} is a string, it works like @code{reverse} i.e., no +destructive modifcation in preference to treat strings as immutable. For example: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-05-20 08:25:18 +0000 +++ src/ChangeLog 2014-05-21 03:49:58 +0000 @@ -1,3 +1,7 @@ +2014-05-21 Leo Liu + + * fns.c (Fnreverse): Accept strings for SEQ and update doc-string. + 2014-05-20 Michael Albinus * dbusbind.c (xd_signature): Revert last 2 patches. === modified file 'src/fns.c' --- src/fns.c 2014-05-15 14:59:02 +0000 +++ src/fns.c 2014-05-21 03:49:58 +0000 @@ -1697,16 +1697,15 @@ } DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, - doc: /* Reverse order of items in a list or vector SEQ. -If SEQ is a list, it should be nil-terminated, and reversed -by modifying cdr pointers. Return the reversed SEQ. - -Note that unlike `reverse', this function doesn't work with strings. -It is strongly encouraged to treat them as immutable. */) + doc: /* Reverse order of items in a list, vector or string SEQ. +If SEQ is a list, it should be nil-terminated. +This function may destructively modify SEQ to produce the value. */) (Lisp_Object seq) { if (NILP (seq)) return seq; + else if (STRINGP (seq)) + return Freverse (seq); else if (CONSP (seq)) { Lisp_Object prev, tail, next; ------------------------------------------------------------ revno: 117132 [merge] committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-05-20 18:55:54 -0700 message: File-local-variable support for sh-script; add mksh support * lisp/files.el (interpreter-mode-alist): Add mksh. * lisp/progmodes/sh-script.el (sh-ancestor-alist): Add mksh, a pdksh derivative. (sh-alias-alist): Alias /system/bin/sh (Android's system shell) to mksh. Improve custom spec; allow regular expressions. (sh-shell): Delegate name splitting to `sh-canonicalize-shell'. (sh-after-hack-local-variables): New function. (sh-mode): Use it; respect file-local `sh-shell' variable. (sh-set-shell): Use `sh-canonicalize-shell' instead of open-coding the normalization. (sh-canonicalize-shell): Rewrite to support regexes. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-21 00:41:21 +0000 +++ lisp/ChangeLog 2014-05-21 01:55:54 +0000 @@ -1,3 +1,18 @@ +2014-05-21 Daniel Colascione + + * files.el (interpreter-mode-alist): Add mksh. + + * progmodes/sh-script.el (sh-ancestor-alist): Add mksh, a pdksh + derivative. + (sh-alias-alist): Alias /system/bin/sh (Android's system shell) to + mksh. Improve custom spec; allow regular expressions. + (sh-shell): Delegate name splitting to `sh-canonicalize-shell'. + (sh-after-hack-local-variables): New function. + (sh-mode): Use it; respect file-local `sh-shell' variable. (bug#17333) + (sh-set-shell): Use `sh-canonicalize-shell' instead of open-coding + the normalization. + (sh-canonicalize-shell): Rewrite to support regexes. + 2014-05-21 Leo Liu * emacs-lisp/cl-lib.el (cl-endp): Fix last change. === modified file 'lisp/files.el' --- lisp/files.el 2014-05-14 17:15:15 +0000 +++ lisp/files.el 2014-05-21 01:54:33 +0000 @@ -2501,6 +2501,7 @@ ("[acjkwz]sh" . sh-mode) ("r?bash2?" . sh-mode) ("dash" . sh-mode) + ("mksh" . sh-mode) ("\\(dt\\|pd\\|w\\)ksh" . sh-mode) ("es" . sh-mode) ("i?tcsh" . sh-mode) === modified file 'lisp/progmodes/sh-script.el' --- lisp/progmodes/sh-script.el 2014-05-04 19:37:56 +0000 +++ lisp/progmodes/sh-script.el 2014-05-21 01:54:33 +0000 @@ -237,6 +237,7 @@ (ksh88 . jsh) (oash . sh) (pdksh . ksh88) + (mksh . pdksh) (posix . sh) (tcsh . csh) (wksh . ksh88) @@ -262,6 +263,7 @@ ksh Korn Shell '93 dtksh CDE Desktop Korn Shell pdksh Public Domain Korn Shell + mksh MirOS BSD Korn Shell wksh Window Korn Shell zsh Z Shell oash SCO OA (curses) Shell @@ -271,7 +273,6 @@ :version "24.4" ; added dash :group 'sh-script) - (defcustom sh-alias-alist (append (if (eq system-type 'gnu/linux) '((csh . tcsh) @@ -279,11 +280,20 @@ ;; for the time being '((ksh . ksh88) (bash2 . bash) - (sh5 . sh))) + (sh5 . sh) + ;; Android's system shell + ("^/system/bin/sh$" . mksh))) "Alist for transforming shell names to what they really are. -Use this where the name of the executable doesn't correspond to the type of -shell it really is." - :type '(repeat (cons symbol symbol)) +Use this where the name of the executable doesn't correspond to +the type of shell it really is. Keys are regular expressions +matched against the full path of the interpreter. (For backward +compatibility, keys may also be symbols, which are matched +against the interpreter's basename. The values are symbols +naming the shell." + :type '(repeat (cons (radio + (regexp :tag "Regular expression") + (symbol :tag "Basename")) + (symbol :tag "Shell"))) :group 'sh-script) @@ -387,15 +397,20 @@ "Non-nil if `sh-shell-variables' is initialized.") (defun sh-canonicalize-shell (shell) - "Convert a shell name SHELL to the one we should handle it as." - (if (string-match "\\.exe\\'" shell) - (setq shell (substring shell 0 (match-beginning 0)))) - (or (symbolp shell) - (setq shell (intern shell))) - (or (cdr (assq shell sh-alias-alist)) - shell)) + "Convert a shell name SHELL to the one we should handle it as. +SHELL is a full path to the shell interpreter; return a shell +name symbol." + (cl-loop + with shell = (cond ((string-match "\\.exe\\'" shell) + (substring shell 0 (match-beginning 0))) + (t shell)) + with shell-base = (intern (file-name-nondirectory shell)) + for (key . value) in sh-alias-alist + if (and (stringp key) (string-match key shell)) return value + if (eq key shell-base) return value + finally return shell-base)) -(defvar sh-shell (sh-canonicalize-shell (file-name-nondirectory sh-shell-file)) +(defvar sh-shell (sh-canonicalize-shell sh-shell-file) "The shell being programmed. This is set by \\[sh-set-shell].") ;;;###autoload(put 'sh-shell 'safe-local-variable 'symbolp) @@ -1533,6 +1548,12 @@ ;; mode-command and utility functions +(defun sh-after-hack-local-variables () + (when (assq 'sh-shell file-local-variables-alist) + (sh-set-shell (if (symbolp sh-shell) + (symbol-name sh-shell) + sh-shell)))) + ;;;###autoload (define-derived-mode sh-mode prog-mode "Shell-script" "Major mode for editing shell scripts. @@ -1643,7 +1664,9 @@ ((string-match "[.]csh\\>" buffer-file-name) "csh") ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") (t sh-shell-file)) - nil nil)) + nil nil) + (add-hook 'hack-local-variables-hook + #'sh-after-hack-local-variables nil t)) ;;;###autoload (defalias 'shell-script-mode 'sh-mode) @@ -2253,9 +2276,7 @@ t)) (if (string-match "\\.exe\\'" shell) (setq shell (substring shell 0 (match-beginning 0)))) - (setq sh-shell (intern (file-name-nondirectory shell)) - sh-shell (or (cdr (assq sh-shell sh-alias-alist)) - sh-shell)) + (setq sh-shell (sh-canonicalize-shell shell)) (if insert-flag (setq sh-shell-file (executable-set-magic shell (sh-feature sh-shell-arg) ------------------------------------------------------------ revno: 117131 committer: Leo Liu branch nick: trunk timestamp: Wed 2014-05-21 08:41:21 +0800 message: * emacs-lisp/cl-lib.el (cl-endp): Fix last change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-19 16:08:40 +0000 +++ lisp/ChangeLog 2014-05-21 00:41:21 +0000 @@ -1,3 +1,7 @@ +2014-05-21 Leo Liu + + * emacs-lisp/cl-lib.el (cl-endp): Fix last change. + 2014-05-19 Leo Liu * emacs-lisp/cl-lib.el (cl-endp): Conform to CL's semantics. === modified file 'lisp/emacs-lisp/cl-lib.el' --- lisp/emacs-lisp/cl-lib.el 2014-05-19 16:08:40 +0000 +++ lisp/emacs-lisp/cl-lib.el 2014-05-21 00:41:21 +0000 @@ -364,7 +364,7 @@ Signal an error if X is not a list." (if (listp x) (null x) - (signal 'wrong-type-argument (list 'list x 'x)))) + (signal 'wrong-type-argument (list 'listp x 'x)))) (cl--defalias 'cl-third 'cl-caddr "Return the third element of the list X.") (cl--defalias 'cl-fourth 'cl-cadddr "Return the fourth element of the list X.") ------------------------------------------------------------ revno: 117130 committer: Michael Albinus branch nick: trunk timestamp: Tue 2014-05-20 10:25:18 +0200 message: * dbusbind.c (xd_signature): Revert last 2 patches. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-05-19 19:19:05 +0000 +++ src/ChangeLog 2014-05-20 08:25:18 +0000 @@ -1,3 +1,7 @@ +2014-05-20 Michael Albinus + + * dbusbind.c (xd_signature): Revert last 2 patches. + 2014-05-19 Paul Eggert Allow any non-nil value to count as true in bool-vector. === modified file 'src/dbusbind.c' --- src/dbusbind.c 2014-05-19 19:19:05 +0000 +++ src/dbusbind.c 2014-05-20 08:25:18 +0000 @@ -387,8 +387,8 @@ break; case DBUS_TYPE_BOOLEAN: - /* Every Emacs Lisp object serves as a boolean, so there's nothing - to check. */ + if (!EQ (object, Qt) && !EQ (object, Qnil)) + wrong_type_argument (intern ("booleanp"), object); sprintf (signature, "%c", dtype); break; ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.