commit cf498e5b9a73329edea0bdbf1bd8dfe06fdd75e2 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Fri Feb 6 19:28:09 2015 -0800 Remove no-longer-used cursor_in_echo_area code * dispnew.c (set_window_cursor_after_update, update_frame_1): Remove checks for negative cursor_in_echo_area, since this var is a boolean, and has been a boolean for some time. Simplify. * dispnew.c (init_display): * xdisp.c (message3_nolog, vmessage): Use bool for boolean. diff --git a/src/ChangeLog b/src/ChangeLog index 15d8d27..cd72f98 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2015-02-07 Paul Eggert + + Remove no-longer-used cursor_in_echo_area code + * dispnew.c (set_window_cursor_after_update, update_frame_1): + Remove checks for negative cursor_in_echo_area, since this var is + a boolean, and has been a boolean for some time. Simplify. + * dispnew.c (init_display): + * xdisp.c (message3_nolog, vmessage): Use bool for boolean. + 2015-02-05 Stefan Monnier * eval.c (Ffunction): Handle the new (:documentation ...) form. diff --git a/src/dispnew.c b/src/dispnew.c index 3c8117e..a178291 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3904,45 +3904,35 @@ set_window_cursor_after_update (struct window *w) { cx = cy = vpos = hpos = 0; - if (cursor_in_echo_area >= 0) + /* If the mini-buffer is several lines high, find the last + line that has any text on it. Note: either all lines + are enabled or none. Otherwise we wouldn't be able to + determine Y. */ + struct glyph_row *last_row = NULL; + int yb = window_text_bottom_y (w); + + for (struct glyph_row *row = w->current_matrix->rows; + row->enabled_p && (!last_row || MATRIX_ROW_BOTTOM_Y (row) <= yb); + row++) + if (row->used[TEXT_AREA] && row->glyphs[TEXT_AREA][0].charpos >= 0) + last_row = row; + + if (last_row) { - /* If the mini-buffer is several lines high, find the last - line that has any text on it. Note: either all lines - are enabled or none. Otherwise we wouldn't be able to - determine Y. */ - struct glyph_row *row, *last_row; - struct glyph *glyph; - int yb = window_text_bottom_y (w); - - last_row = NULL; - row = w->current_matrix->rows; - while (row->enabled_p - && (last_row == NULL - || MATRIX_ROW_BOTTOM_Y (row) <= yb)) - { - if (row->used[TEXT_AREA] - && row->glyphs[TEXT_AREA][0].charpos >= 0) - last_row = row; - ++row; - } + struct glyph *start = last_row->glyphs[TEXT_AREA]; + struct glyph *last = start + last_row->used[TEXT_AREA] - 1; - if (last_row) - { - struct glyph *start = last_row->glyphs[TEXT_AREA]; - struct glyph *last = start + last_row->used[TEXT_AREA] - 1; - - while (last > start && last->charpos < 0) - --last; + while (last > start && last->charpos < 0) + --last; - for (glyph = start; glyph < last; ++glyph) - { - cx += glyph->pixel_width; - ++hpos; - } - - cy = last_row->y; - vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix); + for (struct glyph *glyph = start; glyph < last; glyph++) + { + cx += glyph->pixel_width; + hpos++; } + + cy = last_row->y; + vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix); } } else @@ -4557,58 +4547,43 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p, && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) { int top = WINDOW_TOP_EDGE_LINE (XWINDOW (FRAME_MINIBUF_WINDOW (f))); - int row, col; + int col; - if (cursor_in_echo_area < 0) + /* Put cursor at the end of the prompt. If the mini-buffer + is several lines high, find the last line that has + any text on it. */ + int row = FRAME_TOTAL_LINES (f); + do { - /* Negative value of cursor_in_echo_area means put - cursor at beginning of line. */ - row = top; + row--; col = 0; - } - else - { - /* Positive value of cursor_in_echo_area means put - cursor at the end of the prompt. If the mini-buffer - is several lines high, find the last line that has - any text on it. */ - row = FRAME_TOTAL_LINES (f); - do - { - --row; - col = 0; - if (MATRIX_ROW_ENABLED_P (current_matrix, row)) - { - /* Frame rows are filled up with spaces that - must be ignored here. */ - struct glyph_row *r = MATRIX_ROW (current_matrix, - row); - struct glyph *start = r->glyphs[TEXT_AREA]; - struct glyph *last = start + r->used[TEXT_AREA]; - - while (last > start - && (last - 1)->charpos < 0) - --last; - - col = last - start; - } + if (MATRIX_ROW_ENABLED_P (current_matrix, row)) + { + /* Frame rows are filled up with spaces that + must be ignored here. */ + struct glyph_row *r = MATRIX_ROW (current_matrix, row); + struct glyph *start = r->glyphs[TEXT_AREA]; + + col = r->used[TEXT_AREA]; + while (0 < col && start[col - 1].charpos < 0) + col--; } - while (row > top && col == 0); + } + while (row > top && col == 0); - /* Make sure COL is not out of range. */ - if (col >= FRAME_CURSOR_X_LIMIT (f)) + /* Make sure COL is not out of range. */ + if (col >= FRAME_CURSOR_X_LIMIT (f)) + { + /* If we have another row, advance cursor into it. */ + if (row < FRAME_TOTAL_LINES (f) - 1) { - /* If we have another row, advance cursor into it. */ - if (row < FRAME_TOTAL_LINES (f) - 1) - { - col = FRAME_LEFT_SCROLL_BAR_COLS (f); - row++; - } - /* Otherwise move it back in range. */ - else - col = FRAME_CURSOR_X_LIMIT (f) - 1; + col = FRAME_LEFT_SCROLL_BAR_COLS (f); + row++; } + /* Otherwise move it back in range. */ + else + col = FRAME_CURSOR_X_LIMIT (f) - 1; } cursor_to (f, row, col); @@ -5954,7 +5929,7 @@ init_display (void) space_glyph.charpos = -1; inverse_video = 0; - cursor_in_echo_area = 0; + cursor_in_echo_area = false; /* Now is the time to initialize this; it's used by init_sys_modes during startup. */ diff --git a/src/xdisp.c b/src/xdisp.c index 5c3e641..ef9d72d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10116,7 +10116,7 @@ message3_nolog (Lisp_Object m) fwrite (SDATA (s), SBYTES (s), 1, stderr); } - if (cursor_in_echo_area == 0) + if (!cursor_in_echo_area) fprintf (stderr, "\n"); fflush (stderr); } @@ -10258,7 +10258,7 @@ vmessage (const char *m, va_list ap) putc ('\n', stderr); noninteractive_need_newline = 0; vfprintf (stderr, m, ap); - if (cursor_in_echo_area == 0) + if (!cursor_in_echo_area) fprintf (stderr, "\n"); fflush (stderr); } commit 66e6398505356b019edee4477b6d4f5f8cdec42d Author: Dmitry Gutov Date: Sat Feb 7 04:18:24 2015 +0300 Make vc-test-svn03-working-revision pass * test/automated/vc-tests.el (vc-test--working-revision): Fix `vc-working-revision' checks to be compared against nil, which is what is should return for unregistered files. diff --git a/test/ChangeLog b/test/ChangeLog index f9a54b5..e0d4eeb 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2015-02-07 Dmitry Gutov + + * automated/vc-tests.el (vc-test--working-revision): Fix + `vc-working-revision' checks to be compared against nil, which is + what is should return for unregistered files. + 2015-02-06 Nicolas Petton * automated/seq-tests.el: New tests for seq-mapcat, seq-partition diff --git a/test/automated/vc-tests.el b/test/automated/vc-tests.el index 5b7b3cc..e83eb85 100644 --- a/test/automated/vc-tests.el +++ b/test/automated/vc-tests.el @@ -330,18 +330,20 @@ For backends which dont support it, `vc-not-supported' is signalled." (vc-working-revision default-directory backend) '("0" "master"))) (let ((tmp-name (expand-file-name "foo" default-directory))) - ;; Check for initial state. - (should - (member (vc-working-revision tmp-name backend) '("0" "master"))) + ;; Check for initial state, should be nil until it's registered. + ;; Don't pass the backend explictly, otherwise some implementations + ;; return non-nil. + (should (null (vc-working-revision tmp-name))) - ;; Write a new file. Check for state. + ;; Write a new file. Check state. (write-region "foo" nil tmp-name nil 'nomessage) - (should - (member (vc-working-revision tmp-name backend) '("0" "master"))) + (should (null (vc-working-revision tmp-name))) ;; Register a file. Check for state. (vc-register (list backend (list (file-name-nondirectory tmp-name)))) + ;; FIXME: Don't pass the backend. Emacs should be able to + ;; figure it out. (should (member (vc-working-revision tmp-name backend) '("0" "master"))) commit fa7f79e8234c60ae425f7c3cf1b9486765a7111e Author: Dmitry Gutov Date: Sat Feb 7 02:35:24 2015 +0300 (vc-cvs-dir-status-files): Don't pass DIR to `vc-cvs-command' Fixes: debbugs:19732 * lisp/vc/vc-cvs.el (vc-cvs-dir-status-files): Don't pass DIR to `vc-cvs-command'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ea92da8..c67113f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-06 Dmitry Gutov + + * vc/vc-cvs.el (vc-cvs-dir-status-files): Don't pass DIR to + `vc-cvs-command' (bug#19732). + 2015-02-06 Nicolas Petton * emacs-lisp/seq.el (seq-mapcat, seq-partition, seq-group-by): New functions. diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index d803c16..707090a 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1076,7 +1076,7 @@ Query all files in DIR if files is nil." (if (and (not files) local (not (eq local 'only-file))) (vc-cvs-dir-status-heuristic dir update-function) (if (not files) (setq files (vc-expand-dirs (list dir) 'CVS))) - (vc-cvs-command (current-buffer) 'async dir "-f" "status" files) + (vc-cvs-command (current-buffer) 'async files "-f" "status") ;; Alternative implementation: use the "update" command instead of ;; the "status" command. ;; (vc-cvs-command (current-buffer) 'async commit 7eb2077f9dd14ae9d70a12c621151afd50ea6e96 Author: Nicolas Petton Date: Fri Feb 6 16:01:12 2015 +0100 Add documentation for seq-mapcat, seq-partition and seq-group-by * doc/lispref/sequences.texi (Sequence Functions): Add documentation for seq-mapcat, seq-partition and seq-group-by diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index e928d19..3fe3d6f 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2015-02-06 Nicolas Petton + + * sequences.texi (Sequence Functions): Add documentation for + seq-mapcat, seq-partition and seq-group-by. + 2015-02-05 Martin Rudalics * display.texi (Size of Displayed Text): Remove description of diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index f82c496..f268c0d 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -695,9 +695,54 @@ concatenation of @var{sequences}. @var{type} may be: @code{vector}, @end example @end defun +@defun seq-mapcat function sequence &optional type + This function returns the result of applying @code{seq-concatenate} +to the result of applying @var{function} to each element of +@var{sequence}. The result is a sequence of type @var{type}, or a +list if @var{type} is @code{nil}. + +@example +@group +(seq-mapcat #'seq-reverse '((3 2 1) (6 5 4))) +@result{} (1 2 3 4 5 6) +@end group +@end example +@end defun + +@defun seq-partition sequence n + This function returns a list of the elements of @var{sequence} +grouped into sub-sequences of length @var{n}. The last sequence may +contain less elements than @var{n}. @var{n} must be an integer. If +@var{n} is a negative integer or 0, nil is returned. + +@example +@group +(seq-partition '(0 1 2 3 4 5 6 7) 3) +@result{} ((0 1 2) (3 4 5) (6 7)) +@end group +@end example +@end defun + +@defun seq-group-by function sequence + This function separates the elements of @var{sequence} into an alist +whose keys are the result of applying @var{function} to each element +of @var{sequence}. Keys are compared using @code{equal}. + +@example +@group +(seq-group-by #'integerp '(1 2.1 3 2 3.2)) +@result{} ((t 2 3 1) (nil 3.2 2.1)) +@end group +@group +(seq-group-by #'car '((a 1) (b 2) (a 3) (c 4))) +@result{} ((a (a 3) (a 1)) (b (b 2)) (c (c 4))) +@end group +@end example +@end defun + @defmac seq-doseq (var sequence [result]) body@dots{} @cindex sequence iteration -This macro is like @code{dolist}, except that @var{sequence} can be a list, + This macro is like @code{dolist}, except that @var{sequence} can be a list, vector or string (@pxref{Iteration} for more information about the @code{dolist} macro). This is primarily useful for side-effects. @end defmac commit 58c098199aca5bbd782e36ff629866538cb08e32 Author: Nicolas Petton Date: Fri Feb 6 15:57:54 2015 +0100 Better docstring for seq.el functions * lisp/emacs-lisp/seq.el: Better docstring for seq.el functions diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0cd2a4d..ea92da8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,8 @@ 2015-02-06 Nicolas Petton * emacs-lisp/seq.el (seq-mapcat, seq-partition, seq-group-by): New functions. + * emacs-lisp/seq.el (seq-drop-while, seq-take-while, seq-count) + (seq--drop-list, seq--take-list, seq--take-while-list): Better docstring. 2015-02-06 Artur Malabarba diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index cd45989..025d94e 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -92,14 +92,14 @@ returned." (seq-subseq seq 0 (min (max n 0) (seq-length seq))))) (defun seq-drop-while (pred seq) - "Return a sequence, from the first element for which (PRED element) is nil, of SEQ. + "Return a sequence from the first element for which (PRED element) is nil in SEQ. The result is a sequence of the same type as SEQ." (if (listp seq) (seq--drop-while-list pred seq) (seq-drop seq (seq--count-successive pred seq)))) (defun seq-take-while (pred seq) - "Return a sequence of the successive elements for which (PRED element) is non-nil in SEQ. + "Return the successive elements for which (PRED element) is non-nil in SEQ. The result is a sequence of the same type as SEQ." (if (listp seq) (seq--take-while-list pred seq) @@ -152,7 +152,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called." t)) (defun seq-count (pred seq) - "Return the number of elements for which (PRED element) returns non-nil in seq." + "Return the number of elements for which (PRED element) is non-nil in SEQ." (let ((count 0)) (seq-doseq (elt seq) (when (funcall pred elt) @@ -258,14 +258,16 @@ keys. Keys are compared using `equal'." nil))) (defun seq--drop-list (list n) - "Optimized version of `seq-drop' for lists." + "Return a list from LIST without its first N elements. +This is an optimization for lists in `seq-drop'." (while (and list (> n 0)) (setq list (cdr list) n (1- n))) list) (defun seq--take-list (list n) - "Optimized version of `seq-take' for lists." + "Return a list from LIST made of its first N elements. +This is an optimization for lists in `seq-take'." (let ((result '())) (while (and list (> n 0)) (setq n (1- n)) @@ -273,13 +275,15 @@ keys. Keys are compared using `equal'." (nreverse result))) (defun seq--drop-while-list (pred list) - "Optimized version of `seq-drop-while' for lists." + "Return a list from the first element for which (PRED element) is nil in LIST. +This is an optimization for lists in `seq-drop-while'." (while (and list (funcall pred (car list))) (setq list (cdr list))) list) (defun seq--take-while-list (pred list) - "Optimized version of `seq-take-while' for lists." + "Return the successive elements for which (PRED element) is non-nil in LIST. +This is an optimization for lists in `seq-take-while'." (let ((result '())) (while (and list (funcall pred (car list))) (push (pop list) result)) commit c4a0eff0112298de0a97b63e4e22826bf2b4126c Author: Nicolas Petton Date: Fri Feb 6 15:55:57 2015 +0100 Add seq-partition and seq-group-by * lisp/emacs-lisp/seq.el: Better docstring for seq.el functions * test/automated/seq-tests.el: New tests for seq-partition and seq-group-by diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa58c53..0cd2a4d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,6 @@ 2015-02-06 Nicolas Petton - * emacs-lisp/seq.el (seq-mapcat): New function. + * emacs-lisp/seq.el (seq-mapcat, seq-partition, seq-group-by): New functions. 2015-02-06 Artur Malabarba diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index bd234a3..cd45989 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -230,6 +230,33 @@ The result is a sequence of type TYPE, or a list if TYPE is nil." (apply #'seq-concatenate (or type 'list) (seq-map function seq))) +(defun seq-partition (seq n) + "Return a list of the elements of SEQ grouped into sub-sequences of length N. +The last sequence may contain less than N elements. If N is a +negative integer or 0, nil is returned." + (unless (< n 1) + (let ((result '())) + (while (not (seq-empty-p seq)) + (push (seq-take seq n) result) + (setq seq (seq-drop seq n))) + (nreverse result)))) + +(defun seq-group-by (function seq) + "Apply FUNCTION to each element of SEQ. +Separate the elements of SEQ into an alist using the results as +keys. Keys are compared using `equal'." + (nreverse + (seq-reduce + (lambda (acc elt) + (let* ((key (funcall function elt)) + (cell (assoc key acc))) + (if cell + (setcdr cell (push elt (cdr cell))) + (push (list key elt) acc)) + acc)) + seq + nil))) + (defun seq--drop-list (list n) "Optimized version of `seq-drop' for lists." (while (and list (> n 0)) diff --git a/test/ChangeLog b/test/ChangeLog index 9ae9db3..f9a54b5 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,7 @@ -2015-02-02 Nicolas Petton +2015-02-06 Nicolas Petton - * automated/seq-tests.el: New test for seq-mapcat. + * automated/seq-tests.el: New tests for seq-mapcat, seq-partition + and seq-group-by. 2015-02-05 Artur Malabarba diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el index cc89c88..ecbc004 100644 --- a/test/automated/seq-tests.el +++ b/test/automated/seq-tests.el @@ -205,5 +205,21 @@ Evaluate BODY for each created sequence. (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector) '[1 2 3 4 5 6]))) +(ert-deftest test-seq-partition () + (should (same-contents-p (seq-partition '(0 1 2 3 4 5 6 7) 3) + '((0 1 2) (3 4 5) (6 7)))) + (should (same-contents-p (seq-partition '[0 1 2 3 4 5 6 7] 3) + '([0 1 2] [3 4 5] [6 7]))) + (should (same-contents-p (seq-partition "Hello world" 2) + '("He" "ll" "o " "wo" "rl" "d"))) + (should (equal (seq-partition '() 2) '())) + (should (equal (seq-partition '(1 2 3) -1) '()))) + +(ert-deftest test-seq-group-by () + (should (equal (seq-group-by #'test-sequences-oddp [1 2 3 4]) + '((t 3 1) (nil 4 2)))) + (should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2))) + '((a (a 2) (a 1)) (b (b 3)) (c (c 4)))))) + (provide 'seq-tests) ;;; seq-tests.el ends here commit 05211a578ed2c52f6ed818fc173561afbaea54c2 Author: Nicolas Petton Date: Fri Feb 6 15:52:23 2015 +0100 Add seq-mapcat * lisp/emacs-lisp/seq.el (seq-mapcat): New function * test/automated/seq-tests.el: Add unit tests for seq-mapcat diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 32bbd2c..aa58c53 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-02-06 Nicolas Petton + + * emacs-lisp/seq.el (seq-mapcat): New function. + 2015-02-06 Artur Malabarba * doc-view.el (doc-view-kill-proc-and-buffer): Obsolete. Use diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index b28153b..bd234a3 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -2,9 +2,9 @@ ;; Copyright (C) 2014-2015 Free Software Foundation, Inc. -;; Author: Nicolas Petton +;; Author: Nicolas Petton ;; Keywords: sequences -;; Version: 1.0 +;; Version: 1.1 ;; Maintainer: emacs-devel@gnu.org @@ -224,6 +224,12 @@ TYPE must be one of following symbols: vector, string or list. (`list (apply #'append (append seqs '(nil)))) (t (error "Not a sequence type name: %s" type)))) +(defun seq-mapcat (function seq &optional type) + "Concatenate the result of applying FUNCTION to each element of SEQ. +The result is a sequence of type TYPE, or a list if TYPE is nil." + (apply #'seq-concatenate (or type 'list) + (seq-map function seq))) + (defun seq--drop-list (list n) "Optimized version of `seq-drop' for lists." (while (and list (> n 0)) diff --git a/test/ChangeLog b/test/ChangeLog index 23c4870..9ae9db3 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2015-02-02 Nicolas Petton + + * automated/seq-tests.el: New test for seq-mapcat. + 2015-02-05 Artur Malabarba * automated/package-test.el (package-test-get-deps): Fix typo. diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el index 2398979..cc89c88 100644 --- a/test/automated/seq-tests.el +++ b/test/automated/seq-tests.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2014-2015 Free Software Foundation, Inc. -;; Author: Nicolas Petton +;; Author: Nicolas Petton ;; Maintainer: emacs-devel@gnu.org ;; This file is part of GNU Emacs. @@ -197,5 +197,13 @@ Evaluate BODY for each created sequence. (should (equal (seq-concatenate 'vector nil '(8 10)) [8 10])) (should (equal (seq-concatenate 'vector seq nil) [2 4 6])))) +(ert-deftest test-seq-mapcat () + (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4))) + '(1 2 3 4 5 6))) + (should (equal (seq-mapcat #'seq-reverse '[(3 2 1) (6 5 4)]) + '(1 2 3 4 5 6))) + (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector) + '[1 2 3 4 5 6]))) + (provide 'seq-tests) ;;; seq-tests.el ends here commit 5c9ad35f1e5fd8ee5561ef48baac1f6ff20ae679 Author: Artur Malabarba Date: Thu Feb 5 15:57:01 2015 -0200 doc-view.el (doc-view-kill-proc-and-buffer): Obsolete. Use image-kill-buffer instead. (doc-view-mode): Add `doc-view-kill-proc' to `kill-buffer-hook'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68c2dab..32bbd2c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-06 Artur Malabarba + + * doc-view.el (doc-view-kill-proc-and-buffer): Obsolete. Use + `image-kill-buffer' instead. + 2015-02-06 Thomas Fitzsimmons * net/ldap.el (ldap-search-internal): Fix docstring. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index b718f1d..5f1c94a 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -415,7 +415,6 @@ Typically \"page-%s.png\".") (define-key map "H" 'doc-view-fit-height-to-window) (define-key map "P" 'doc-view-fit-page-to-window) ;; Killing the buffer (and the process) - (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) (define-key map (kbd "K") 'doc-view-kill-proc) ;; Slicing the image (define-key map (kbd "s s") 'doc-view-set-slice) @@ -645,12 +644,8 @@ at the top edge of the page moves to the previous page." (setq doc-view--current-timer nil)) (setq mode-line-process nil)) -(defun doc-view-kill-proc-and-buffer () - "Kill the current converter process and buffer." - (interactive) - (doc-view-kill-proc) - (when (eq major-mode 'doc-view-mode) - (kill-buffer (current-buffer)))) +(define-obsolete-function-alias 'doc-view-kill-proc-and-buffer + #'image-kill-buffer "25.1") (defun doc-view-make-safe-dir (dir) (condition-case nil commit e14961fca13be44a737b32fb1346554a7832a690 Author: Artur Malabarba Date: Wed Feb 4 18:02:14 2015 -0200 image-mode.el (image-kill-buffer): New command bound to k. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31f10d3..68c2dab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -108,6 +108,9 @@ 2015-02-04 Artur Malabarba + * image-mode.el (image-kill-buffer): New command. + (image-mode-map): Bind it to k. + * emacs-lisp/package.el (package-delete): Remove package from `package-selected-packages' even if it can't be deleted. (package-installed-p): Accept package-desc objects. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 9e527f1..e6d6a3e 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -380,6 +380,7 @@ call." (define-key map "a-" 'image-decrease-speed) (define-key map "a0" 'image-reset-speed) (define-key map "ar" 'image-reverse-speed) + (define-key map "k" 'image-kill-buffer) (define-key map [remap forward-char] 'image-forward-hscroll) (define-key map [remap backward-char] 'image-backward-hscroll) (define-key map [remap right-char] 'image-forward-hscroll) @@ -722,6 +723,11 @@ the image by calling `image-mode'." (image-mode-as-text) (image-mode))) +(defun image-kill-buffer () + "Kill the current buffer." + (interactive) + (kill-buffer (current-buffer))) + (defun image-after-revert-hook () (when (image-get-display-property) (image-toggle-display-text)