------------------------------------------------------------ revno: 117115 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-05-15 23:06:55 -0700 message: * etc/TODO: Add entry on printing. diff: === modified file 'etc/TODO' --- etc/TODO 2014-02-07 03:19:39 +0000 +++ etc/TODO 2014-05-16 06:06:55 +0000 @@ -309,6 +309,12 @@ * Other features we would like: +** A more modern printing interface. One that pops up a dialog that lets +you choose printer, page style, etc. +Integration with the Gtk print dialog is apparently difficult. See eg: +http://lists.gnu.org/archive/html/emacs-devel/2009-03/msg00501.html +http://lists.gnu.org/archive/html/emacs-devel/2009-04/msg00034.html + ** Allow frames(terminals) created by emacsclient to inherit their environment from the emacsclient process. ** Remove the default toggling behavior of minor modes when called from elisp ------------------------------------------------------------ revno: 117114 committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2014-05-15 23:31:30 +0000 message: lisp/gnus/gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part): Fix last change diff: === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2014-05-15 06:53:44 +0000 +++ lisp/gnus/gnus-art.el 2014-05-15 23:31:30 +0000 @@ -5346,6 +5346,9 @@ ((mm-handle-undisplayer handle) (mm-remove-part handle))) (goto-char start) + (unless (bolp) + ;; This is a header button. + (forward-line 1)) (mm-display-inline handle)) ;; Toggle the button appearance between `[button]...' and `[button]'. (goto-char btn) @@ -5364,22 +5367,25 @@ (point-max))) (dolist (annot annots) (set-extent-endpoints annot (point) (point))))) - (unless (or displayed-p (eolp)) - ;; Add extra newline. - (insert (propertize (buffer-substring (1- (point)) (point)) - 'gnus-undeletable t)))) - (unless (search-backward "\n\n" nil t) - ;; We're in the article header. - (delete-char -1) - (dolist (ovl (gnus-overlays-in btn (point))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) - (save-restriction - (message-narrow-to-field) - (let ((gnus-treatment-function-alist - '((gnus-treat-highlight-headers - gnus-article-highlight-headers)))) - (gnus-treat-article 'head)))) + (setq start (point)) + (if (search-backward "\n\n" nil t) + (progn + (goto-char start) + (unless (or displayed-p (eolp)) + ;; Add extra newline. + (insert (propertize (buffer-substring (1- start) start) + 'gnus-undeletable t)))) + ;; We're in the article header. + (delete-char -1) + (dolist (ovl (gnus-overlays-in btn (point))) + (gnus-overlay-put ovl 'gnus-button-attachment-extra t) + (gnus-overlay-put ovl 'face nil)) + (save-restriction + (message-narrow-to-field) + (let ((gnus-treatment-function-alist + '((gnus-treat-highlight-headers + gnus-article-highlight-headers)))) + (gnus-treat-article 'head))))) (goto-char b)))) (defun gnus-mime-set-charset-parameters (handle charset) @@ -5712,6 +5718,9 @@ (unless (zerop (buffer-size)) (buffer-string)))))) (goto-char start) + (unless (bolp) + ;; This is a header button. + (forward-line 1)) (cond ((stringp part) (save-restriction (narrow-to-region (point) @@ -5746,22 +5755,25 @@ (point-max))) (dolist (annot annots) (set-extent-endpoints annot (point) (point))))) - (unless (or displayed-p (eolp)) - ;; Add extra newline. - (insert (propertize (buffer-substring (1- (point)) (point)) - 'gnus-undeletable t)))) - (unless (search-backward "\n\n" nil t) - ;; We're in the article header. - (delete-char -1) - (dolist (ovl (gnus-overlays-in point (point))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) - (save-restriction - (message-narrow-to-field) - (let ((gnus-treatment-function-alist - '((gnus-treat-highlight-headers - gnus-article-highlight-headers)))) - (gnus-treat-article 'head)))) + (setq start (point)) + (if (search-backward "\n\n" nil t) + (progn + (goto-char start) + (unless (or displayed-p (eolp)) + ;; Add extra newline. + (insert (propertize (buffer-substring (1- start) start) + 'gnus-undeletable t)))) + ;; We're in the article header. + (delete-char -1) + (dolist (ovl (gnus-overlays-in point (point))) + (gnus-overlay-put ovl 'gnus-button-attachment-extra t) + (gnus-overlay-put ovl 'face nil)) + (save-restriction + (message-narrow-to-field) + (let ((gnus-treatment-function-alist + '((gnus-treat-highlight-headers + gnus-article-highlight-headers)))) + (gnus-treat-article 'head))))) (goto-char point) (if (window-live-p window) (select-window window))) ------------------------------------------------------------ revno: 117113 committer: Jan D. branch nick: trunk timestamp: Thu 2014-05-15 18:55:18 +0200 message: Fix typo diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-15 16:54:44 +0000 +++ ChangeLog 2014-05-15 16:55:18 +0000 @@ -1,6 +1,6 @@ 2014-05-15 Jan Djärv - * configure.ac (LIBONG): Do not test for libpng if NS_IMPL_COCOA. + * configure.ac (LIBPNG): Do not test for libpng if NS_IMPL_COCOA. 2014-05-13 Dmitry Antipov ------------------------------------------------------------ revno: 117112 committer: Jan D. branch nick: trunk timestamp: Thu 2014-05-15 18:54:44 +0200 message: Fix yet another configure error on OSX. * configure.ac (LIBONG): Do not test for libpng if NS_IMPL_COCOA. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-13 14:18:54 +0000 +++ ChangeLog 2014-05-15 16:54:44 +0000 @@ -1,3 +1,7 @@ +2014-05-15 Jan Djärv + + * configure.ac (LIBONG): Do not test for libpng if NS_IMPL_COCOA. + 2014-05-13 Dmitry Antipov * configure.ac (HAVE_XFIXES): Define if available. === modified file 'configure.ac' --- configure.ac 2014-05-13 14:18:54 +0000 +++ configure.ac 2014-05-15 16:54:44 +0000 @@ -3070,7 +3070,9 @@ HAVE_PNG=no LIBPNG= PNG_CFLAGS= -if test "${with_png}" != no; then +if test "${NS_IMPL_COCOA}" = yes; then + : # Nothing to do +elif test "${with_png}" != no; then # mingw32 loads the library dynamically. if test "$opsys" = mingw32; then AC_CHECK_HEADER([png.h], [HAVE_PNG=yes]) ------------------------------------------------------------ revno: 117111 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2014-05-15 18:59:02 +0400 message: * src/fns.c (Fnreverse): Allow vectors and bool vectors. * doc/lispref/lists.texi (Building Cons Cells and Lists): Remove description of `nreverse' and generalize it... * doc/lispref/sequences.texi (Sequences): ...for sequences here. * tests/automated/fns-tests.el (fns-tests-nreverse) (fns-tests-nreverse-bool-vector): New tests. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-05-15 06:01:46 +0000 +++ doc/lispref/ChangeLog 2014-05-15 14:59:02 +0000 @@ -1,7 +1,7 @@ 2014-05-15 Dmitry Antipov * lists.texi (Building Cons Cells and Lists): Remove - description of `reverse' and generalize it... + description of `reverse' and `'nreverse' to generalize them... * sequences.texi (Sequences): ...for sequences here. 2014-05-14 Glenn Morris === modified file 'doc/lispref/lists.texi' --- doc/lispref/lists.texi 2014-05-15 06:01:46 +0000 +++ doc/lispref/lists.texi 2014-05-15 14:59:02 +0000 @@ -1124,58 +1124,6 @@ @end smallexample @end defun -@defun nreverse list -@cindex reversing a list - This function reverses the order of the elements of @var{list}. -Unlike @code{reverse}, @code{nreverse} alters its argument by reversing -the @sc{cdr}s in the cons cells forming the list. The cons cell that -used to be the last one in @var{list} becomes the first cons cell of the -value. - - For example: - -@example -@group -(setq x '(a b c)) - @result{} (a b c) -@end group -@group -x - @result{} (a b c) -(nreverse x) - @result{} (c b a) -@end group -@group -;; @r{The cons cell that was first is now last.} -x - @result{} (a) -@end group -@end example - - To avoid confusion, we usually store the result of @code{nreverse} -back in the same variable which held the original list: - -@example -(setq x (nreverse x)) -@end example - - Here is the @code{nreverse} of our favorite example, @code{(a b c)}, -presented graphically: - -@smallexample -@group -@r{Original list head:} @r{Reversed list:} - ------------- ------------- ------------ -| car | cdr | | car | cdr | | car | cdr | -| a | nil |<-- | b | o |<-- | c | o | -| | | | | | | | | | | | | - ------------- | --------- | - | -------- | - - | | | | - ------------- ------------ -@end group -@end smallexample -@end defun - @defun sort list predicate @cindex stable sort @cindex sorting lists === modified file 'doc/lispref/sequences.texi' --- doc/lispref/sequences.texi 2014-05-15 06:01:46 +0000 +++ doc/lispref/sequences.texi 2014-05-15 14:59:02 +0000 @@ -260,6 +260,75 @@ @end example @end defun +@defun nreverse seq +@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 +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. + + For example: + +@example +@group +(setq x '(a b c)) + @result{} (a b c) +@end group +@group +x + @result{} (a b c) +(nreverse x) + @result{} (c b a) +@end group +@group +;; @r{The cons cell that was first is now last.} +x + @result{} (a) +@end group +@end example + + To avoid confusion, we usually store the result of @code{nreverse} +back in the same variable which held the original list: + +@example +(setq x (nreverse x)) +@end example + + Here is the @code{nreverse} of our favorite example, @code{(a b c)}, +presented graphically: + +@smallexample +@group +@r{Original list head:} @r{Reversed list:} + ------------- ------------- ------------ +| car | cdr | | car | cdr | | car | cdr | +| a | nil |<-- | b | o |<-- | c | o | +| | | | | | | | | | | | | + ------------- | --------- | - | -------- | - + | | | | + ------------- ------------ +@end group +@end smallexample + + For the vector, it is even simpler because you don't need setq: + +@example +(setq x [1 2 3 4]) + @result{} [1 2 3 4] +(nreverse x) + @result{} [4 3 2 1] +x + @result{} [4 3 2 1] +@end example + +Note that unlike @code{reverse}, this function doesn't work with strings. +Although you can alter string data by using @code{aset}, it is strongly +encouraged to treat strings as immutable. + +@end defun + @node Arrays @section Arrays @cindex array === modified file 'src/ChangeLog' --- src/ChangeLog 2014-05-15 06:01:46 +0000 +++ src/ChangeLog 2014-05-15 14:59:02 +0000 @@ -1,6 +1,7 @@ 2014-05-15 Dmitry Antipov * fns.c (Freverse): Allow vectors, bool vectors and strings. + (Fnreverse): Allow vectors and bool vectors. 2014-05-14 Dmitry Antipov === modified file 'src/fns.c' --- src/fns.c 2014-05-15 06:01:46 +0000 +++ src/fns.c 2014-05-15 14:59:02 +0000 @@ -1697,25 +1697,55 @@ } DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, - doc: /* Reverse LIST by modifying cdr pointers. -Return the reversed list. Expects a properly nil-terminated list. */) - (Lisp_Object list) + 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. */) + (Lisp_Object seq) { - register Lisp_Object prev, tail, next; - - if (NILP (list)) return list; - prev = Qnil; - tail = list; - while (!NILP (tail)) - { - QUIT; - CHECK_LIST_CONS (tail, tail); - next = XCDR (tail); - Fsetcdr (tail, prev); - prev = tail; - tail = next; - } - return prev; + if (NILP (seq)) + return seq; + else if (CONSP (seq)) + { + Lisp_Object prev, tail, next; + + for (prev = Qnil, tail = seq; !NILP (tail); tail = next) + { + QUIT; + CHECK_LIST_CONS (tail, tail); + next = XCDR (tail); + Fsetcdr (tail, prev); + prev = tail; + } + seq = prev; + } + else if (VECTORP (seq)) + { + ptrdiff_t i, size = ASIZE (seq); + + for (i = 0; i < size / 2; i++) + { + Lisp_Object tem = AREF (seq, i); + ASET (seq, i, AREF (seq, size - i - 1)); + ASET (seq, size - i - 1, tem); + } + } + else if (BOOL_VECTOR_P (seq)) + { + ptrdiff_t i, size = bool_vector_size (seq); + + for (i = 0; i < size / 2; i++) + { + bool tem = bool_vector_bitref (seq, i); + bool_vector_set (seq, i, bool_vector_bitref (seq, size - i - 1)); + bool_vector_set (seq, size - i - 1, tem); + } + } + else + wrong_type_argument (Qarrayp, seq); + return seq; } DEFUN ("reverse", Freverse, Sreverse, 1, 1, 0, === modified file 'test/ChangeLog' --- test/ChangeLog 2014-05-15 10:06:45 +0000 +++ test/ChangeLog 2014-05-15 14:59:02 +0000 @@ -1,6 +1,8 @@ 2014-05-15 Dmitry Antipov * automated/fns-tests.el: New file. + * automated/fns-tests.el (fns-tests-nreverse) + (fns-tests-nreverse-bool-vector): New tests. 2014-05-08 Glenn Morris === modified file 'test/automated/fns-tests.el' --- test/automated/fns-tests.el 2014-05-15 10:06:45 +0000 +++ test/automated/fns-tests.el 2014-05-15 14:59:02 +0000 @@ -28,12 +28,44 @@ (should-error (reverse)) (should-error (reverse 1)) (should-error (reverse (make-char-table 'foo))) + (should (equal [] (reverse []))) + (should (equal [0] (reverse [0]))) (should (equal [1 2 3 4] (reverse (reverse [1 2 3 4])))) + (should (equal '(a b c d) (reverse (reverse '(a b c d))))) (should (equal "xyzzy" (reverse (reverse "xyzzy")))) (should (equal "こんにちは / コンニチハ" (reverse (reverse "こんにちは / コンニチハ"))))) +(ert-deftest fns-tests-nreverse () + (should-error (nreverse)) + (should-error (nreverse 1)) + (should-error (nreverse (make-char-table 'foo))) + (should-error (nreverse "xyzzy")) + (let ((A [])) + (nreverse A) + (should (equal A []))) + (let ((A [0])) + (nreverse A) + (should (equal A [0]))) + (let ((A [1 2 3 4])) + (nreverse A) + (should (equal A [4 3 2 1]))) + (let ((A [1 2 3 4])) + (nreverse A) + (nreverse A) + (should (equal A [1 2 3 4]))) + (let* ((A [1 2 3 4]) + (B (nreverse (nreverse A)))) + (should (equal A B)))) + (ert-deftest fns-tests-reverse-bool-vector () (let ((A (make-bool-vector 10 nil))) (dotimes (i 5) (aset A i t)) (should (equal [nil nil nil nil nil t t t t t] (vconcat (reverse A)))) (should (equal A (reverse (reverse A)))))) + +(ert-deftest fns-tests-nreverse-bool-vector () + (let ((A (make-bool-vector 10 nil))) + (dotimes (i 5) (aset A i t)) + (nreverse A) + (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) + (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) ------------------------------------------------------------ revno: 117110 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2014-05-15 14:06:45 +0400 message: * tests/automated/fns-tests.el: New file. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-05-08 07:02:08 +0000 +++ test/ChangeLog 2014-05-15 10:06:45 +0000 @@ -1,3 +1,7 @@ +2014-05-15 Dmitry Antipov + + * automated/fns-tests.el: New file. + 2014-05-08 Glenn Morris * automated/vc-bzr.el (vc-bzr-test-bug9726, vc-bzr-test-bug9781) === added file 'test/automated/fns-tests.el' --- test/automated/fns-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/fns-tests.el 2014-05-15 10:06:45 +0000 @@ -0,0 +1,39 @@ +;;; fns-tests.el --- tests for src/fns.c + +;; Copyright (C) 2014 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; 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 `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;;; Code: + +(require 'cl-lib) +(eval-when-compile (require 'cl)) + +(ert-deftest fns-tests-reverse () + (should-error (reverse)) + (should-error (reverse 1)) + (should-error (reverse (make-char-table 'foo))) + (should (equal [1 2 3 4] (reverse (reverse [1 2 3 4])))) + (should (equal "xyzzy" (reverse (reverse "xyzzy")))) + (should (equal "こんにちは / コンニチハ" (reverse (reverse "こんにちは / コンニチハ"))))) + +(ert-deftest fns-tests-reverse-bool-vector () + (let ((A (make-bool-vector 10 nil))) + (dotimes (i 5) (aset A i t)) + (should (equal [nil nil nil nil nil t t t t t] (vconcat (reverse A)))) + (should (equal A (reverse (reverse A)))))) ------------------------------------------------------------ revno: 117109 committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2014-05-15 06:53:44 +0000 message: lisp/gnus/gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part): Don't delete next part button; keep spacing between buttons diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2014-05-14 08:50:51 +0000 +++ lisp/gnus/ChangeLog 2014-05-15 06:53:44 +0000 @@ -1,3 +1,8 @@ +2014-05-15 Katsumi Yamaoka + + * gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part): Don't + delete next part button; keep spacing between buttons. + 2014-05-14 Katsumi Yamaoka * gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part): === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2014-05-14 08:50:51 +0000 +++ lisp/gnus/gnus-art.el 2014-05-15 06:53:44 +0000 @@ -5311,14 +5311,14 @@ (text-property-any (point-min) (point) 'gnus-data handle))) (setq handle (get-text-property b 'gnus-data)) b)) - contents charset coding-system) + start contents charset coding-system) (when handle (when (= b (prog1 btn - (setq btn (previous-single-property-change - (or (next-single-property-change btn 'gnus-data) - (point-max)) - 'gnus-data)))) + (setq start (next-single-property-change btn 'gnus-data + nil (point-max)) + btn (previous-single-property-change start + 'gnus-data)))) (setq b btn)) (if (and (not arg) (mm-handle-undisplayer handle)) (mm-remove-part handle) @@ -5345,25 +5345,29 @@ (mm-read-coding-system "Charset: ")))) ((mm-handle-undisplayer handle) (mm-remove-part handle))) - (forward-line 1) + (goto-char start) (mm-display-inline handle)) ;; Toggle the button appearance between `[button]...' and `[button]'. (goto-char btn) - (gnus-insert-mime-button handle (get-text-property btn 'gnus-part) - (list (mm-handle-displayed-p handle))) - (if (featurep 'emacs) - (delete-region - (point) - (or (text-property-any (point) (point-max) 'gnus-data nil) - (point-max))) - (let* ((end (text-property-any (point) (point-max) 'gnus-data nil)) - (annots (annotations-at end))) - (delete-region (point) - (if end - (if annots (1+ end) end) - (point-max))) - (dolist (annot annots) - (set-extent-endpoints annot (point) (point))))) + (let ((displayed-p (mm-handle-displayed-p handle))) + (gnus-insert-mime-button handle (get-text-property btn 'gnus-part) + (list displayed-p)) + (if (featurep 'emacs) + (delete-region + (point) + (next-single-property-change (point) 'gnus-data nil (point-max))) + (let* ((end (next-single-property-change (point) 'gnus-data)) + (annots (annotations-at (or end (point-max))))) + (delete-region (point) + (if end + (if annots (1+ end) end) + (point-max))) + (dolist (annot annots) + (set-extent-endpoints annot (point) (point))))) + (unless (or displayed-p (eolp)) + ;; Add extra newline. + (insert (propertize (buffer-substring (1- (point)) (point)) + 'gnus-undeletable t)))) (unless (search-backward "\n\n" nil t) ;; We're in the article header. (delete-char -1) @@ -5686,17 +5690,16 @@ (with-current-buffer gnus-summary-buffer gnus-newsgroup-ignored-charsets) nil)) - retval) + start retval) (unwind-protect (progn (let ((win (gnus-get-buffer-window (current-buffer) t))) (when win (select-window win) (goto-char point))) - (setq point (previous-single-property-change - (or (next-single-property-change point 'gnus-data) - (point-max)) - 'gnus-data)) + (setq start (next-single-property-change point 'gnus-data + nil (point-max)) + point (previous-single-property-change start 'gnus-data)) (if (mm-handle-displayed-p handle) ;; This will remove the part. (setq retval (mm-display-part handle)) @@ -5708,7 +5711,7 @@ (setq retval (mm-display-part handle))) (unless (zerop (buffer-size)) (buffer-string)))))) - (forward-line) + (goto-char start) (cond ((stringp part) (save-restriction (narrow-to-region (point) @@ -5729,20 +5732,24 @@ (mm-display-inline handle)))))) (goto-char point) ;; Toggle the button appearance between `[button]...' and `[button]'. - (gnus-insert-mime-button handle id (list (mm-handle-displayed-p handle))) - (if (featurep 'emacs) - (delete-region - (point) - (or (text-property-any (point) (point-max) 'gnus-data nil) - (point-max))) - (let* ((end (text-property-any (point) (point-max) 'gnus-data nil)) - (annots (annotations-at end))) - (delete-region (point) - (if end - (if annots (1+ end) end) - (point-max))) - (dolist (annot annots) - (set-extent-endpoints annot (point) (point))))) + (let ((displayed-p (mm-handle-displayed-p handle))) + (gnus-insert-mime-button handle id (list displayed-p)) + (if (featurep 'emacs) + (delete-region + (point) + (next-single-property-change (point) 'gnus-data nil (point-max))) + (let* ((end (next-single-property-change (point) 'gnus-data)) + (annots (annotations-at (or end (point-max))))) + (delete-region (point) + (if end + (if annots (1+ end) end) + (point-max))) + (dolist (annot annots) + (set-extent-endpoints annot (point) (point))))) + (unless (or displayed-p (eolp)) + ;; Add extra newline. + (insert (propertize (buffer-substring (1- (point)) (point)) + 'gnus-undeletable t)))) (unless (search-backward "\n\n" nil t) ;; We're in the article header. (delete-char -1)