commit 24849c1b8d348379203c07c400bedfd42059963f (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sat Apr 25 16:17:25 2020 -0700 Inline a couple of functions that were macros This reclaims a bit of performance when compiling with gcc -Og. These functions were macros until I changed them in 2020-04-17T14:57:25Z!eggert@cs.ucla.edu. * src/casefiddle.c (make_char_unibyte): * src/ccl.c (GET_TRANSLATION_TABLE): Now inline. diff --git a/src/casefiddle.c b/src/casefiddle.c index 9a711a8fba..debd241223 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -221,7 +221,7 @@ case_character (struct casing_str_buf *buf, struct casing_context *ctx, } /* If C is not ASCII, make it unibyte. */ -static int +static inline int make_char_unibyte (int c) { return ASCII_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c); diff --git a/src/ccl.c b/src/ccl.c index 0f82b97f6a..ef059ffff2 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -856,7 +856,7 @@ struct ccl_prog_stack static struct ccl_prog_stack ccl_prog_stack_struct[256]; /* Return a translation table of id number ID. */ -static Lisp_Object +static inline Lisp_Object GET_TRANSLATION_TABLE (int id) { return XCDR (XVECTOR (Vtranslation_table_vector)->contents[id]); commit 7b82650c60bd044c046601fc337c8a46b4fb853c Author: Stefan Kangas Date: Sun Apr 26 01:00:39 2020 +0200 Use lexical-binding in dig.el and add tests * lisp/net/dig.el: Use lexical-binding. (dig-program, dig-dns-server, dig-font-lock-keywords): Remove redundant :group args. * test/lisp/net/dig-tests.el: New file. diff --git a/lisp/net/dig.el b/lisp/net/dig.el index 852d8ae049..f36999119f 100644 --- a/lisp/net/dig.el +++ b/lisp/net/dig.el @@ -1,4 +1,4 @@ -;;; dig.el --- Domain Name System dig interface +;;; dig.el --- Domain Name System dig interface -*- lexical-binding:t -*- ;; Copyright (C) 2000-2020 Free Software Foundation, Inc. @@ -42,15 +42,13 @@ (defcustom dig-program "dig" "Name of dig (domain information groper) binary." - :type 'file - :group 'dig) + :type 'file) (defcustom dig-dns-server nil "DNS server to query. If nil, use system defaults." :type '(choice (const :tag "System defaults") - string) - :group 'dig) + string)) (defcustom dig-font-lock-keywords '(("^;; [A-Z]+ SECTION:" 0 font-lock-keyword-face) @@ -58,8 +56,7 @@ If nil, use system defaults." ("^; <<>>.*" 0 font-lock-type-face) ("^;.*" 0 font-lock-function-name-face)) "Default expressions to highlight in dig mode." - :type 'sexp - :group 'dig) + :type 'sexp) (defun dig-invoke (domain &optional query-type query-class query-option diff --git a/test/lisp/net/dig-tests.el b/test/lisp/net/dig-tests.el new file mode 100644 index 0000000000..1b14384634 --- /dev/null +++ b/test/lisp/net/dig-tests.el @@ -0,0 +1,56 @@ +;;; dig-tests.el --- Tests for dig.el -*- lexical-binding:t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'dig) + +(defvar dig-test-result-data " +; <<>> DiG 9.11.16-2-Debian <<>> gnu.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7777 +;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 4096 +;; QUESTION SECTION: +;gnu.org. IN A + +;; ANSWER SECTION: +gnu.org. 300 IN A 111.11.111.111 + +;; Query time: 127 msec +;; SERVER: 192.168.0.1#53(192.168.0.1) +;; WHEN: Sun Apr 26 00:47:55 CEST 2020 +;; MSG SIZE rcvd: 52 + +" "Data used to test dig.el.") + +(ert-deftest dig-test-dig-extract-rr () + (with-temp-buffer + (insert dig-test-result-data) + (should (equal (dig-extract-rr "gnu.org") + "gnu.org. 300 IN A 111.11.111.111")))) + +(provide 'dig-tests) +;;; dig-tests.el ends here commit 0e2cd5f5ab8e3e870fde7c70cbc75fdd2b405746 Author: Stefan Kangas Date: Sun Apr 26 00:27:47 2020 +0200 Use lexical-binding in misc.el and add tests * lisp/misc.el: Use lexical-binding. * test/lisp/misc-tests.el: New file. diff --git a/lisp/misc.el b/lisp/misc.el index 3a0989bcab..8c39492784 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -1,4 +1,4 @@ -;;; misc.el --- some nonstandard editing and utility commands for Emacs +;;; misc.el --- some nonstandard editing and utility commands for Emacs -*- lexical-binding:t -*- ;; Copyright (C) 1989, 2001-2020 Free Software Foundation, Inc. diff --git a/test/lisp/misc-tests.el b/test/lisp/misc-tests.el new file mode 100644 index 0000000000..fbcbfb7d0c --- /dev/null +++ b/test/lisp/misc-tests.el @@ -0,0 +1,77 @@ +;;; misc-tests.el --- Tests for misc.el -*- lexical-binding:t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Stefan Kangas + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(defmacro with-misc-test (original result &rest body) + (declare (indent 2)) + `(with-temp-buffer + (insert ,original) + ,@body + (should (equal (buffer-string) ,result)))) + +(ert-deftest misc-test-copy-from-above-command () + (with-misc-test "abc\n" "abc\nabc" + (copy-from-above-command)) + (with-misc-test "abc\n" "abc\nab" + (copy-from-above-command 2))) + +(ert-deftest misc-test-zap-up-to-char () + (with-misc-test "abcde" "cde" + (goto-char (point-min)) + (zap-up-to-char 1 ?c)) + (with-misc-test "abcde abc123" "c123" + (goto-char (point-min)) + (zap-up-to-char 2 ?c))) + +(ert-deftest misc-test-upcase-char () + (with-misc-test "abcde" "aBCDe" + (goto-char (1+ (point-min))) + (upcase-char 3))) + +(ert-deftest misc-test-forward-to-word () + (with-temp-buffer + (insert " - abc") + (goto-char (point-min)) + (forward-to-word 1) + (should (equal (point) 9))) + (with-temp-buffer + (insert "a b c") + (goto-char (point-min)) + (forward-to-word 3) + (should (equal (point) 6)))) + +(ert-deftest misc-test-backward-to-word () + (with-temp-buffer + (insert "abc - ") + (backward-to-word 1) + (should (equal (point) 4))) + (with-temp-buffer + (insert "a b c") + (backward-to-word 3) + (should (equal (point) 1)))) + +(provide 'misc-tests) +;;; misc-tests.el ends here commit eb65ac526c9dd350b8a6548f2f453a550dac5821 Author: Stefan Kangas Date: Sat Apr 25 23:30:22 2020 +0200 Improve list-dynamic-libraries when alist empty * lisp/misc.el (list-dynamic-libraries--refresh): Improve list format and show message when 'dynamic-library-alist' is empty. diff --git a/lisp/misc.el b/lisp/misc.el index 05244a6ea2..3a0989bcab 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -162,7 +162,7 @@ Internal use only." "Recompute the list of dynamic libraries. Internal use only." (setq tabulated-list-format ; recomputed because column widths can change - (let ((max-id-len 0) (max-name-len 0)) + (let ((max-id-len 7) (max-name-len 11)) (dolist (lib dynamic-library-alist) (let ((id-len (length (symbol-name (car lib)))) (name-len (apply 'max (mapcar 'length (cdr lib))))) @@ -181,7 +181,9 @@ Internal use only." (push (list id (vector (symbol-name id) (list-dynamic-libraries--loaded from) (mapconcat 'identity (cdr lib) ", "))) - tabulated-list-entries))))) + tabulated-list-entries)))) + (when (not dynamic-library-alist) + (message "No dynamic libraries found"))) ;;;###autoload (defun list-dynamic-libraries (&optional loaded-only-p buffer) commit 519567878fa32715aa377d1fa23240f09ce291f6 Merge: f7748ad682 45a64c97c7 Author: Glenn Morris Date: Sat Apr 25 07:50:21 2020 -0700 Merge from origin/emacs-27 45a64c97c7 (origin/emacs-27) Clarify semantics of trace-function CONT... 821760fdc4 Don't let a code literal get modified in mml parsing (Bug#... 74a92be16d * lisp/simple.el (kill-ring-save): Doc fix. (Bug#40797) 3d0e859692 Minor doc clarification regarding fringe bitmaps 4d86c7f822 Fix documentation of fringe bitmaps a76af88dd8 Tweak mutability doc a bit more f7e488d206 Calc: fix autoload errors (bug#40800) 369761b36d ; * src/xdisp.c: Improve the introductory commentary. a92ca1f177 Improve indexing of ELisp manual 5a25d17760 * lisp/image-mode.el (image-transform-resize): Remove FIXM... 37ebec3a95 Improve the default value of 'doc-view-ghostscript-program'. ba6104d1e8 Change doc-view-mode-map prefix key 's' to 'c'. 400ff5cd19 Improve wording about constants d2836fe71b Improve the default value of 'doc-view-ghostscript-program'. fc55f65305 Minor improvements in documentation of the last change a64da75961 Add image-auto-resize defcustoms to image-mode.el 692ad40539 Improve the documentation of tab-bar and tab-line # Conflicts: # etc/NEWS commit 45a64c97c74c34d3d2e912a670b30aa10dbf439c Author: Noam Postavsky Date: Tue Apr 14 22:10:58 2020 -0400 Clarify semantics of trace-function CONTEXT argument * lisp/emacs-lisp/trace.el (trace-function-foreground): Explain that CONTEXT should be a function, when called from Lisp. diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 5c35036a50..4ebb7ff711 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -292,7 +292,9 @@ If `current-prefix-arg' is non-nil, also read a buffer and a \"context\" (defun trace-function-foreground (function &optional buffer context) "Trace calls to function FUNCTION. With a prefix argument, also prompt for the trace buffer (default -`trace-buffer'), and a Lisp expression CONTEXT. +`trace-buffer'), and a Lisp expression CONTEXT. When called from +Lisp, CONTEXT should be a function of no arguments which returns +a value to insert into BUFFER during the trace. Tracing a function causes every call to that function to insert into BUFFER Lisp-style trace messages that display the function's commit 821760fdc439214f57212708e23d5c87088d34ee Author: Noam Postavsky Date: Thu Apr 16 20:24:26 2020 -0400 Don't let a code literal get modified in mml parsing (Bug#39884) * lisp/gnus/mml.el (mml-parse-1): Make a fresh cons for the tag type, because 'mml-generate-mime' destructively modifies it. diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index cdd8f3d3a5..556cf0804a 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -281,7 +281,7 @@ part. This is for the internal use, you should never modify the value.") (setq tag (mml-read-tag) no-markup-p nil warn nil) - (setq tag (list 'part '(type . "text/plain")) + (setq tag (list 'part (cons 'type "text/plain")) no-markup-p t warn t)) (setq raw (cdr (assq 'raw tag)) commit f7748ad682abca5968ce24ed488ba56d2e48ef8a Author: Eli Zaretskii Date: Sat Apr 25 16:37:46 2020 +0300 Fix GDI+ image loading by file name Without a call to image_find_image, we can get a file name that is relative to data-directory/images/, or a file name that starts with "~/", in which case w32_load_image would fail. * src/image.c (native_image_load): Call image_find_image_file to resolve and encode the image file name. * src/w32image.c (w32_load_image): No need to encode the file name, as it's already encoded by native_image_load. diff --git a/src/image.c b/src/image.c index ffe2f607e5..c8a192aaaf 100644 --- a/src/image.c +++ b/src/image.c @@ -6308,14 +6308,16 @@ native_image_p (Lisp_Object object) static bool native_image_load (struct frame *f, struct image *img) { + Lisp_Object image_file = image_spec_value (img->spec, QCfile, NULL); + + if (STRINGP (image_file)) + image_file = image_find_image_file (image_file); # ifdef HAVE_NTGUI - return w32_load_image (f, img, - image_spec_value (img->spec, QCfile, NULL), + return w32_load_image (f, img, image_file, image_spec_value (img->spec, QCdata, NULL)); # elif defined HAVE_NS - return ns_load_image (f, img, - image_spec_value (img->spec, QCfile, NULL), + return ns_load_image (f, img, image_file, image_spec_value (img->spec, QCdata, NULL)); # else return 0; diff --git a/src/w32image.c b/src/w32image.c index 8d39a09dc7..70b2eb29b8 100644 --- a/src/w32image.c +++ b/src/w32image.c @@ -414,7 +414,6 @@ w32_load_image (struct frame *f, struct image *img, and succeeded. We have a valid token and GDI+ is active. */ if (STRINGP (spec_file)) { - spec_file = ENCODE_FILE (spec_file); const char *fn = map_w32_filename (SSDATA (spec_file), NULL); wchar_t filename_w[MAX_PATH]; filename_to_utf16 (fn, filename_w); commit 74a92be16dd3a2a89f33d4ded36c12a773ec6122 Author: Eli Zaretskii Date: Sat Apr 25 13:04:16 2020 +0300 * lisp/simple.el (kill-ring-save): Doc fix. (Bug#40797) diff --git a/lisp/simple.el b/lisp/simple.el index e3169e523b..ab277c4e11 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4809,7 +4809,7 @@ In Transient Mark mode, deactivate the mark. If `interprogram-cut-function' is non-nil, also save the text for a window system cut and paste. -If you want to append the killed line to the last killed text, +If you want to append the killed region to the last killed text, use \\[append-next-kill] before \\[kill-ring-save]. The copied text is filtered by `filter-buffer-substring' before it is commit 3d0e859692956d706154a7af4e072a9f23f0cd78 Author: Clément Pit-Claudel Date: Wed Apr 22 17:46:07 2020 -0400 Minor doc clarification regarding fringe bitmaps * doc/lispref/display.texi (Customizing Bitmaps): Add a note regarding the order of bits being the opposite of that in XBM images. (Bug#40784) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 0b7358ea17..e655f2f0ca 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -4342,7 +4342,8 @@ The argument @var{bits} specifies the image to use. It should be either a string or a vector of integers, where each element (an integer) corresponds to one row of the bitmap. Each bit of an integer corresponds to one pixel of the bitmap, where the low bit corresponds -to the rightmost pixel of the bitmap. +to the rightmost pixel of the bitmap. (Note that this order of bits +is opposite of the order in XBM images; @pxref{XBM Images}.) The height is normally the length of @var{bits}. However, you can specify a different height with non-@code{nil} @var{height}. The width commit 4d86c7f8227a90b02854ab42f25b32e218cb3687 Author: Eli Zaretskii Date: Sat Apr 25 12:48:14 2020 +0300 Fix documentation of fringe bitmaps * doc/lispref/display.texi (Fringe Bitmaps): The 'empty-line' fringe indicator _is_ used. (Bug#40799) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 4e73afeaf9..0b7358ea17 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -4158,8 +4158,8 @@ topmost and bottommost buffer text line; and @code{top-bottom} indicates where there is just one line of text in the buffer. @item @code{empty-line} -Used to indicate empty lines when @code{indicate-empty-lines} is -non-@code{nil}. +Used to indicate empty lines after the buffer end when +@code{indicate-empty-lines} is non-@code{nil}. @item @code{overlay-arrow} Used for overlay arrows (@pxref{Overlay Arrow}). @@ -4301,6 +4301,7 @@ The former is used by overlay arrows. The latter is unused. @itemx @code{bottom-left-angle}, @code{bottom-right-angle} @itemx @code{top-left-angle}, @code{top-right-angle} @itemx @code{left-bracket}, @code{right-bracket} +@itemx @code{empty-line} Used to indicate buffer boundaries. @item @code{filled-rectangle}, @code{hollow-rectangle} @@ -4308,7 +4309,7 @@ Used to indicate buffer boundaries. @itemx @code{vertical-bar}, @code{horizontal-bar} Used for different types of fringe cursors. -@item @code{empty-line}, @code{exclamation-mark}, @code{question-mark} +@item @code{exclamation-mark}, @code{question-mark} Not used by core Emacs features. @end table commit 2a3a0a843f66db6f693e084b2fbd40eeda70afbc Author: Igor Saprykin Date: Thu Apr 23 13:00:26 2020 -0700 Remove unused variable from ftfont.c * src/ftfont.c (ftfont_lookup_cache): Eliminate unnecessary variable. Copyright-paperwork-exempt: yes diff --git a/src/ftfont.c b/src/ftfont.c index 6b549c3ddf..696f5e6534 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -346,18 +346,15 @@ struct ftfont_cache_data static Lisp_Object ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) { - Lisp_Object cache, val, entity; + Lisp_Object cache, val; struct ftfont_cache_data *cache_data; if (FONT_ENTITY_P (key)) { - entity = key; - val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX)); + val = assq_no_quit (QCfont_entity, AREF (key, FONT_EXTRA_INDEX)); eassert (CONSP (val)); key = XCDR (val); } - else - entity = Qnil; if (NILP (ft_face_cache)) cache = Qnil; commit 9dd4ff6e9d597d5c0dadbcd5910ae2cb1f8bd258 Author: Eli Zaretskii Date: Sat Apr 25 12:11:57 2020 +0300 Fix two fringe bitmaps * src/fringe.c (question_mark_bits, exclamation_mark_bits): Fix the numerical values. (Bug#40805) diff --git a/src/fringe.c b/src/fringe.c index d8d80bb3fe..fc4c738dc2 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -101,7 +101,7 @@ struct fringe_bitmap ...xx... */ static unsigned short question_mark_bits[] = { - 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; + 0x3c, 0x7e, 0xc3, 0xc3, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; /* An exclamation mark. */ /* @@ -117,7 +117,7 @@ static unsigned short question_mark_bits[] = { ...XX... */ static unsigned short exclamation_mark_bits[] = { - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18}; + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18}; /* An arrow like this: `<-'. */ /* commit a76af88dd872091f78bb1a4716750934f6fbaab3 Author: Paul Eggert Date: Fri Apr 24 19:19:31 2020 -0700 Tweak mutability doc a bit more Inspired by a comment from Michael Heerdegen (Bug#40671#114). * doc/lispref/objects.texi (Constants and Mutability): Tweak further. diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 1eda94ab63..b4e9ff4411 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -2401,8 +2401,8 @@ literal @code{"aaa"} yields a constant string, whereas the function call @code{(make-string 3 ?a)} yields a mutable string that can be changed via later calls to @code{aset}. - A mutable object can become constant if it is passed to the -@code{eval} function, because a program should not modify an object + A mutable object can become constant if it is part of an expression +that is evaluated, because a program should not modify an object that is being evaluated. The reverse does not occur: constant objects should stay constant. commit f7e488d20694dea6d2cbb5f74381f7e6f1e4d484 Author: Mattias Engdegård Date: Fri Apr 24 12:49:42 2020 +0200 Calc: fix autoload errors (bug#40800) Reported by Hugo Daschbach. * lisp/calc/calc-ext.el (calc-init-extensions): Remove calc-kbd-report key binding and autoload; it was removed in 2005. calc-keypad-x-{left,right,middle}-click were renamed to calc-keypad-{left,right,middle}-click in 2001; fix the autoloads. calc-twos-complement-mode is a variable, not a function; remove the autoload. * lisp/calc/calc-prog.el: Remove commented-out calc-kbd-report. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index bc70ec283f..5c11554d5d 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -674,7 +674,6 @@ (define-key calc-mode-map "Z/" 'calc-kbd-break) (define-key calc-mode-map "Z`" 'calc-kbd-push) (define-key calc-mode-map "Z'" 'calc-kbd-pop) - (define-key calc-mode-map "Z=" 'calc-kbd-report) (define-key calc-mode-map "Z#" 'calc-kbd-query) (calc-init-prefixes) @@ -845,8 +844,8 @@ math-bernoulli-number math-gammap1-raw) ("calc-incom" calc-digit-dots) ("calc-keypd" calc-do-keypad -calc-keypad-x-left-click calc-keypad-x-middle-click -calc-keypad-x-right-click) +calc-keypad-left-click calc-keypad-middle-click +calc-keypad-right-click) ("calc-lang" calc-set-language math-read-big-balance math-read-big-rec) @@ -1003,7 +1002,7 @@ calc-find-root calc-poly-interp) calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part) - ("calc-bin" calc-and calc-binary-radix calc-clip calc-twos-complement-mode + ("calc-bin" calc-and calc-binary-radix calc-clip calc-decimal-radix calc-diff calc-hex-radix calc-leading-zeros calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size @@ -1116,7 +1115,7 @@ calc-equal-to calc-get-user-defn calc-greater-equal calc-greater-than calc-in-set calc-kbd-break calc-kbd-else calc-kbd-else-if calc-kbd-end-for calc-kbd-end-if calc-kbd-end-loop calc-kbd-end-repeat calc-kbd-for calc-kbd-if calc-kbd-loop calc-kbd-pop calc-kbd-push -calc-kbd-query calc-kbd-repeat calc-kbd-report calc-less-equal +calc-kbd-query calc-kbd-repeat calc-less-equal calc-less-than calc-logical-and calc-logical-if calc-logical-not calc-logical-or calc-not-equal-to calc-pass-errors calc-remove-equal calc-timing calc-user-define calc-user-define-composition diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index e88aa92364..6db5de4c96 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -1452,11 +1452,6 @@ Redefine the corresponding command." (error "%s" "Unbalanced Z' in keyboard macro"))) -;; (defun calc-kbd-report (msg) -;; (interactive "sMessage: ") -;; (calc-wrapper -;; (math-working msg (calc-top-n 1)))) - (defun calc-kbd-query () (interactive) (let ((defining-kbd-macro nil) commit 369761b36db12c65296a39bb874bb181da466009 Author: Eli Zaretskii Date: Fri Apr 24 18:09:20 2020 +0300 ; * src/xdisp.c: Improve the introductory commentary. diff --git a/src/xdisp.c b/src/xdisp.c index a4de2698ca..19f4f32618 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -30,8 +30,9 @@ along with GNU Emacs. If not, see . */ Updating the display is triggered by the Lisp interpreter when it decides it's time to do it. This is done either automatically for you as part of the interpreter's command loop or as the result of - calling Lisp functions like `sit-for'. The C function `redisplay' - in xdisp.c is the only entry into the inner redisplay code. + calling Lisp functions like `sit-for'. The C function + `redisplay_internal' in xdisp.c is the only entry into the inner + redisplay code. The following diagram shows how redisplay code is invoked. As you can see, Lisp calls redisplay and vice versa. @@ -89,7 +90,15 @@ along with GNU Emacs. If not, see . */ second glyph matrix is constructed, the so called `desired glyph matrix' or short `desired matrix'. Current and desired matrix are then compared to find a cheap way to update the display, e.g. by - reusing part of the display by scrolling lines. + reusing part of the display by scrolling lines. The actual update + of the display of each window by comparing the desired and the + current matrix is done by `update_window', which calls functions + which draw to the glass (those functions are specific to the type + of the window's frame: X, w32, NS, etc.). + + Once the display of a window on the glass has been updated, its + desired matrix is used to update the corresponding rows of the + current matrix, and then the desired matrix is discarded. You will find a lot of redisplay optimizations when you start looking at the innards of redisplay. The overall goal of all these @@ -119,13 +128,13 @@ along with GNU Emacs. If not, see . */ . try_window - This function performs the full redisplay of a single window - assuming that its fonts were not changed and that the cursor - will not end up in the scroll margins. (Loading fonts requires - re-adjustment of dimensions of glyph matrices, which makes this - method impossible to use.) + This function performs the full, unoptimized, redisplay of a + single window assuming that its fonts were not changed and that + the cursor will not end up in the scroll margins. (Loading + fonts requires re-adjustment of dimensions of glyph matrices, + which makes this method impossible to use.) - These optimizations are tried in sequence (some can be skipped if + The optimizations are tried in sequence (some can be skipped if it is known that they are not applicable). If none of the optimizations were successful, redisplay calls redisplay_windows, which performs a full redisplay of all windows. @@ -145,38 +154,62 @@ along with GNU Emacs. If not, see . */ Desired matrices. - Desired matrices are always built per Emacs window. The function - `display_line' is the central function to look at if you are - interested. It constructs one row in a desired matrix given an + Desired matrices are always built per Emacs window. It is + important to know that a desired matrix is in general "sparse": it + only has some of the glyph rows "enabled". This is because + redisplay tries to optimize its work, and thus only generates + glyphs for rows that need to be updated on the screen. Rows that + don't need to be updated are left "disabled", and their contents + should be ignored. + + The function `display_line' is the central function to look at if + you are interested in how the rows of the desired matrix are + produced. It constructs one row in a desired matrix given an iterator structure containing both a buffer position and a description of the environment in which the text is to be displayed. But this is too early, read on. + Glyph rows. + + A glyph row is an array of `struct glyph', where each glyph element + describes a "display element" to be shown on the screen. More + accurately, a glyph row can have up to 3 different arrays of + glyphs: one each for every display margins, and one for the "text + area", where buffer text is displayed. The text-area glyph array + is always present, whereas the arrays for the marginal areas are + present (non-empty) only if the corresponding display margin is + shown in the window. If the glyph array for a marginal area is not + present its beginning and end coincide, i.e. such arrays are + actually empty (they contain no glyphs). Frame glyph matrics, used + on text-mode terminals (see below) never have marginal areas, they + treat the entire frame-wide row of glyphs as a single large "text + area". + Iteration over buffer and strings. Characters and pixmaps displayed for a range of buffer text depend on various settings of buffers and windows, on overlays and text properties, on display tables, on selective display. The good news is that all this hairy stuff is hidden behind a small set of - interface functions taking an iterator structure (struct it) + interface functions taking an iterator structure (`struct it') argument. Iteration over things to be displayed is then simple. It is - started by initializing an iterator with a call to init_iterator, + started by initializing an iterator with a call to `init_iterator', passing it the buffer position where to start iteration. For - iteration over strings, pass -1 as the position to init_iterator, - and call reseat_to_string when the string is ready, to initialize + iteration over strings, pass -1 as the position to `init_iterator', + and call `reseat_to_string' when the string is ready, to initialize the iterator for that string. Thereafter, calls to - get_next_display_element fill the iterator structure with relevant - information about the next thing to display. Calls to - set_iterator_to_next move the iterator to the next thing. + `get_next_display_element' fill the iterator structure with + relevant information about the next thing to display. Calls to + `set_iterator_to_next' move the iterator to the next thing. Besides this, an iterator also contains information about the display environment in which glyphs for display elements are to be produced. It has fields for the width and height of the display, the information whether long lines are truncated or continued, a - current X and Y position, and lots of other stuff you can better - see in dispextern.h. + current X and Y position, the face currently in effect, and lots of + other stuff you can better see in dispextern.h. The "stop position". @@ -184,57 +217,62 @@ along with GNU Emacs. If not, see . */ infrequently. These include the face of the characters, whether text is invisible, the object (buffer or display or overlay string) being iterated, character composition info, etc. For any given - buffer or string position, the sources of information that - affects the display can be determined by calling the appropriate - primitives, such as Fnext_single_property_change, but both these + buffer or string position, the sources of information that affects + the display can be determined by calling the appropriate + primitives, such as `Fnext_single_property_change', but both these calls and the processing of their return values is relatively expensive. To optimize redisplay, the display engine checks these - sources of display information only when needed. To that end, it - always maintains the position of the next place where it must stop - and re-examine all those potential sources. This is called "stop - position" and is stored in the stop_charpos field of the iterator. - The stop position is updated by compute_stop_pos, which is called - whenever the iteration reaches the current stop position and - processes it. Processing a stop position is done by handle_stop, - which invokes a series of handlers, one each for every potential - source of display-related information; see the it_props array for - those handlers. For example, one handler is handle_face_prop, - which detects changes in face properties, and supplies the face ID - that the iterator will use for all the glyphs it generates up to - the next stop position; this face ID is the result of realizing the - face specified by the relevant text properties at this position. - Each handler called by handle_stop processes the sources of display + sources of display information only when needed, not for every + character. To that end, it always maintains the position of the + next place where it must stop and re-examine all those potential + sources. This is called "the stop position" and is stored in the + `stop_charpos' field of the iterator. The stop position is updated + by `compute_stop_pos', which is called whenever the iteration + reaches the current stop position and processes it. Processing a + stop position is done by `handle_stop', which invokes a series of + handlers, one each for every potential source of display-related + information; see the `it_props' array for those handlers. For + example, one handler is `handle_face_prop', which detects changes + in face properties, and supplies the face ID that the iterator will + use for all the glyphs it generates up to the next stop position; + this face ID is the result of "realizing" the face specified by the + relevant text properties at this position (see xfaces.c). Each + handler called by `handle_stop' processes the sources of display information for which it is "responsible", and returns a value - which tells handle_stop what to do next. + which tells `handle_stop' what to do next. + + Once `handle_stop' returns, the information it stores in the + iterator fields will not be refreshed until the iteration reaches + the next stop position, which is computed by `compute_stop_pos' + called at the end of `handle_stop'. `compute_stop_pos' examines + the buffer's or string's interval tree to determine where the text + properties change, finds the next position where overlays and + character composition can change, and stores in `stop_charpos' the + closest position where any of these factors should be reconsidered. - Once handle_stop returns, the information it stores in the iterator - fields will not be refreshed until the iteration reaches the next - stop position, which is computed by compute_stop_pos called at the - end of handle_stop. compute_stop_pos examines the buffer's or - string's interval tree to determine where the text properties - change, finds the next position where overlays and character - composition can change, and stores in stop_charpos the closest - position where any of these factors should be reconsidered. + Handling of the stop position is done as part of the code in + `get_next_display_element'. Producing glyphs. Glyphs in a desired matrix are normally constructed in a loop - calling get_next_display_element and then PRODUCE_GLYPHS. The call - to PRODUCE_GLYPHS will fill the iterator structure with pixel - information about the element being displayed and at the same time - produce glyphs for it. If the display element fits on the line - being displayed, set_iterator_to_next is called next, otherwise the - glyphs produced are discarded. The function display_line is the - workhorse of filling glyph rows in the desired matrix with glyphs. - In addition to producing glyphs, it also handles line truncation - and continuation, word wrap, and cursor positioning (for the - latter, see also set_cursor_from_row). + calling `get_next_display_element' and then `PRODUCE_GLYPHS'. The + call to `PRODUCE_GLYPHS' will fill the iterator structure with + pixel information about the element being displayed and at the same + time will produce glyphs for it. If the display element fits on + the line being displayed, `set_iterator_to_next' is called next, + otherwise the glyphs produced are discarded, and `display_line' + marks this glyph row as a "continued line". The function + `display_line' is the workhorse of filling glyph rows in the + desired matrix with glyphs. In addition to producing glyphs, it + also handles line truncation and continuation, word wrap, and + cursor positioning (for the latter, see `set_cursor_from_row'). Frame matrices. That just couldn't be all, could it? What about terminal types not supporting operations on sub-windows of the screen (a.k.a. "TTY" or - "text-mode terminal")? To update the display on such a terminal, + "text-mode terminals")? To update the display on such a terminal, window-based glyph matrices are not well suited. To be able to reuse part of the display (scrolling lines up and down), we must instead have a view of the whole screen. This is what `frame @@ -252,19 +290,62 @@ along with GNU Emacs. If not, see . */ using the frame matrices, which allows frame-global optimization of what is actually written to the glass. - To be honest, there is a little bit more done, but not much more. - If you plan to extend that code, take a look at dispnew.c. The - function build_frame_matrix is a good starting point. + Frame matrices don't have marginal areas, only a text area. That + is, the entire row of glyphs that spans the width of a text-mode + frame is treated as a single large "text area" for the purposes of + manipulating and updating a frame glyph matrix. + + To be honest, there is a little bit more done for frame matrices, + but not much more. If you plan to extend that code, take a look at + dispnew.c. The function build_frame_matrix is a good starting + point. + + Simulating display. + + Some of Emacs commands and functions need to take display layout + into consideration. For example, C-n moves to the next screen + line, but to implement that, Emacs needs to find the buffer + position which is directly below the cursor position on display. + This is not trivial when buffer display includes variable-size + elements such as different fonts, tall images, etc. + + To solve this problem, the display engine implements several + functions that can move through buffer text in the same manner as + `display_line' and `display_string' do, but without producing any + glyphs for the glyph matrices. The workhorse of this is + `move_it_in_display_line_to'. Its code and logic are very similar + to `display_line', but it differs in two important aspects: it + doesn't produce glyphs for any glyph matrix, and it returns a + status telling the caller how it ended the iteration: whether it + reached the required position, hit the end of line, arrived at the + window edge without exhausting the buffer's line, etc. Since the + glyphs are not produced, the layout information available to the + callers of this function is what is recorded in `struct it' by the + iteration process. + + Several higher-level functions call `move_it_in_display_line_to' to + perform more complex tasks: `move_it_by_lines' can move N lines up + or down from a given buffer position and `move_it_to' can move to a + given buffer position or to a given X or Y pixel coordinate. + + These functions are called by the display engine itself as well, + when it needs to make layout decisions before producing the glyphs. + For example, one of the first things to decide when redisplaying a + window is where to put the `window-start' position; if the window + is to be recentered (the default), Emacs makes that decision by + starting from the position of point, then moving up the number of + lines corresponding to half the window height using + `move_it_by_lines'. Bidirectional display. Bidirectional display adds quite some hair to this already complex design. The good news are that a large portion of that hairy stuff is hidden in bidi.c behind only 3 interfaces. bidi.c implements a - reordering engine which is called by set_iterator_to_next and + reordering engine which is called by `set_iterator_to_next' and returns the next character to display in the visual order. See commentary on bidi.c for more details. As far as redisplay is - concerned, the effect of calling bidi_move_to_visually_next, the + concerned, the effect of calling `bidi_move_to_visually_next', the main interface of the reordering engine, is that the iterator gets magically placed on the buffer or string position that is to be displayed next in the visual order. In other words, a linear @@ -279,27 +360,27 @@ along with GNU Emacs. If not, see . */ monotonously changing with vertical positions. Also, accounting for face changes, overlays, etc. becomes more complex because non-linear iteration could potentially skip many positions with - changes, and then cross them again on the way back (see - handle_stop_backwards)... + such changes, and then cross them again on the way back (see + `handle_stop_backwards')... One other prominent effect of bidirectional display is that some paragraphs of text need to be displayed starting at the right margin of the window---the so-called right-to-left, or R2L paragraphs. R2L paragraphs are displayed with R2L glyph rows, - which have their reversed_p flag set. The bidi reordering engine + which have their `reversed_p' flag set. The bidi reordering engine produces characters in such rows starting from the character which - should be the rightmost on display. PRODUCE_GLYPHS then reverses - the order, when it fills up the glyph row whose reversed_p flag is - set, by prepending each new glyph to what is already there, instead - of appending it. When the glyph row is complete, the function - extend_face_to_end_of_line fills the empty space to the left of the - leftmost character with special glyphs, which will display as, - well, empty. On text terminals, these special glyphs are simply - blank characters. On graphics terminals, there's a single stretch - glyph of a suitably computed width. Both the blanks and the - stretch glyph are given the face of the background of the line. - This way, the terminal-specific back-end can still draw the glyphs - left to right, even for R2L lines. + should be the rightmost on display. `PRODUCE_GLYPHS' then reverses + the order, when it fills up the glyph row whose `reversed_p' flag + is set, by prepending each new glyph to what is already there, + instead of appending it. When the glyph row is complete, the + function `extend_face_to_end_of_line' fills the empty space to the + left of the leftmost character with special glyphs, which will + display as, well, empty. On text terminals, these special glyphs + are simply blank characters. On graphics terminals, there's a + single stretch glyph of a suitably computed width. Both the blanks + and the stretch glyph are given the face of the background of the + line. This way, the terminal-specific back-end can still draw the + glyphs left to right, even for R2L lines. Bidirectional display and character compositions. @@ -310,23 +391,23 @@ along with GNU Emacs. If not, see . */ Emacs display supports this by providing "character compositions", most of which is implemented in composite.c. During the buffer - scan that delivers characters to PRODUCE_GLYPHS, if the next + scan that delivers characters to `PRODUCE_GLYPHS', if the next character to be delivered is a composed character, the iteration - calls composition_reseat_it and next_element_from_composition. If - they succeed to compose the character with one or more of the + calls `composition_reseat_it' and `next_element_from_composition'. + If they succeed to compose the character with one or more of the following characters, the whole sequence of characters that were composed is recorded in the `struct composition_it' object that is part of the buffer iterator. The composed sequence could produce one or more font glyphs (called "grapheme clusters") on the screen. - Each of these grapheme clusters is then delivered to PRODUCE_GLYPHS - in the direction corresponding to the current bidi scan direction - (recorded in the scan_dir member of the `struct bidi_it' object - that is part of the iterator). In particular, if the bidi iterator - currently scans the buffer backwards, the grapheme clusters are - delivered back to front. This reorders the grapheme clusters as - appropriate for the current bidi context. Note that this means - that the grapheme clusters are always stored in the LGSTRING object - (see composite.c) in the logical order. + Each of these grapheme clusters is then delivered to + `PRODUCE_GLYPHS' in the direction corresponding to the current bidi + scan direction (recorded in the `scan_dir' member of the `struct + bidi_it' object that is part of the iterator). In particular, if + the bidi iterator currently scans the buffer backwards, the + grapheme clusters are delivered back to front. This reorders the + grapheme clusters as appropriate for the current bidi context. + Note that this means that the grapheme clusters are always stored + in the `LGSTRING' object (see composite.c) in the logical order. Moving an iterator in bidirectional text without producing glyphs. @@ -337,18 +418,18 @@ along with GNU Emacs. If not, see . */ As far as the iterator is concerned, the geometry of such rows is still left to right, i.e. the iterator "thinks" the first character is at the leftmost pixel position. The iterator does not know that - PRODUCE_GLYPHS reverses the order of the glyphs that the iterator - delivers. This is important when functions from the move_it_* + `PRODUCE_GLYPHS' reverses the order of the glyphs that the iterator + delivers. This is important when functions from the `move_it_*' family are used to get to certain screen position or to match screen coordinates with buffer coordinates: these functions use the iterator geometry, which is left to right even in R2L paragraphs. - This works well with most callers of move_it_*, because they need + This works well with most callers of `move_it_*', because they need to get to a specific column, and columns are still numbered in the reading order, i.e. the rightmost character in a R2L paragraph is still column zero. But some callers do not get well with this; a notable example is mouse clicks that need to find the character that corresponds to certain pixel coordinates. See - buffer_posn_from_coords in dispnew.c for how this is handled. */ + `buffer_posn_from_coords' in dispnew.c for how this is handled. */ #include #include commit a92ca1f177547837516bb6aba959ffeb23c2519c Author: Stefan Kangas Date: Fri Apr 24 07:58:17 2020 +0200 Improve indexing of ELisp manual * doc/lispref/tips.texi (Tips): Add index entry 'best practices'. diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 1ca97e2f09..3b8da35b6c 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -8,6 +8,7 @@ @cindex tips for writing Lisp @cindex standards of coding style @cindex coding standards +@cindex best practices This chapter describes no additional features of Emacs Lisp. Instead it gives advice on making effective use of the features described in the commit 5a25d17760144494ea905c437f2935b5b645c30d Author: Juri Linkov Date: Fri Apr 24 01:50:48 2020 +0300 * lisp/image-mode.el (image-transform-resize): Remove FIXME comment. The user customizable variable 'image-auto-resize' is documented now in the manual. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 08f04f1d7f..3ee185a0dc 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -79,7 +79,6 @@ resizing according to the value specified in `image-auto-resize'." :version "27.1" :group 'image) -;; FIXME this doesn't seem mature yet. Document in manual when it is. (defvar-local image-transform-resize nil "The image resize operation. Its value should be one of the following: commit 37ebec3a95cecd970c578e1955c940b3ad9f4e56 Author: Tassilo Horn Date: Thu Apr 23 18:25:07 2020 +0200 Improve the default value of 'doc-view-ghostscript-program'. * lisp/doc-view.el (doc-view-ghostscript-program): Use plain command name instead of qualified name returned by executable-find (as suggested by Stefan Monnier). (Bug#36357) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 714fdf8b08..171a939d4e 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -155,20 +155,18 @@ (defcustom doc-view-ghostscript-program (cond ((memq system-type '(windows-nt ms-dos)) - (or + (cond ;; Windows Ghostscript - (executable-find "gswin64c") - (executable-find "gswin32c") + ((executable-find "gswin64c") "gswin64c") + ((executable-find "gswin32c") "gswin32c") ;; The GS wrapper coming with TeX Live - (executable-find "rungs") + ((executable-find "rungs") "rungs") ;; The MikTeX builtin GS Check if mgs is functional for external ;; non-MikTeX apps. Was available under: ;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx - (when-let ((mgs (executable-find "mgs"))) - (when (= 0 (shell-command - (concat (shell-quote-argument mgs) - " -q -dNODISPLAY -c quit"))) - mgs)))) + ((and (executable-find "mgs") + (= 0 (shell-command "mgs -q -dNODISPLAY -c quit"))) + "mgs"))) (t "gs")) "Program to convert PS and PDF files to PNG." :type 'file commit ba6104d1e8db4e8db2f12acaebf092ef579c6632 Author: Juri Linkov Date: Thu Apr 23 02:14:42 2020 +0300 Change doc-view-mode-map prefix key 's' to 'c'. * doc/emacs/misc.texi (DocView Slicing): Change prefix key 's' to 'c'. * lisp/doc-view.el (doc-view-mode-map): Change prefix key 's' to 'c'. * lisp/image-mode.el (image-mode-map): Add image-transform-set-scale to menu. * doc/emacs/files.texi (Image Mode): Describe commands image-transform-fit-both, image-transform-set-scale, image-transform-reset. * etc/NEWS: Rearrange image sections. https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg01315.html diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 7318667403..56ce7fdea1 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2113,8 +2113,6 @@ point. Partial Completion mode offers other features extending @findex image-mode @findex image-toggle-display -@findex image-next-file -@findex image-previous-file @cindex images, viewing Visiting image files automatically selects Image mode. In this major mode, you can type @kbd{C-c C-c} (@code{image-toggle-display}) @@ -2136,6 +2134,19 @@ window, so this is only necessary if you customize the default behavior by using the options @code{image-auto-resize} and @code{image-auto-resize-on-window-resize}. +@findex image-transform-fit-both +@findex image-transform-set-scale +@findex image-transform-reset +To resize the image manually you can use the command +@code{image-transform-fit-both} bound to @kbd{s b} +that fits the image to both the window height and width. +To scale the image specifying a scale factor, use the command +@code{image-transform-set-scale} bound to @kbd{s s}. +To reset all transformations to the initial state, use +@code{image-transform-reset} bound to @kbd{s 0}. + +@findex image-next-file +@findex image-previous-file You can press @kbd{n} (@code{image-next-file}) and @kbd{p} (@code{image-previous-file}) to visit the next image file and the previous image file in the same directory, respectively. @@ -2204,7 +2215,6 @@ can be used to transform the image in question to @acronym{PNG} before displaying. GraphicsMagick, ImageMagick and @command{ffmpeg} are currently supported for image conversions. - @findex thumbs-mode @cindex mode, Thumbs The Image-Dired package can also be used to view images as diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index dceb8d3ca5..47f195d0b2 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -617,12 +617,12 @@ of pages to display. A slice is a rectangle within the page area; once you specify a slice in DocView, it applies to whichever page you look at. - To specify the slice numerically, type @kbd{s s} + To specify the slice numerically, type @kbd{c s} (@code{doc-view-set-slice}); then enter the top left pixel position and the slice's width and height. @c ??? how does this work? - A more convenient graphical way to specify the slice is with @kbd{s + A more convenient graphical way to specify the slice is with @kbd{c m} (@code{doc-view-set-slice-using-mouse}), where you use the mouse to select the slice. Simply press and hold the left mouse button at the upper-left corner of the region you want to have in the slice, then @@ -631,10 +631,10 @@ button. The most convenient way is to set the optimal slice by using BoundingBox information automatically determined from the document by -typing @kbd{s b} (@code{doc-view-set-slice-from-bounding-box}). +typing @kbd{c b} (@code{doc-view-set-slice-from-bounding-box}). @findex doc-view-reset-slice - To cancel the selected slice, type @kbd{s r} + To cancel the selected slice, type @kbd{c r} (@code{doc-view-reset-slice}). Then DocView shows the entire page including its entire margins. diff --git a/etc/NEWS b/etc/NEWS index 65ac6d2a2f..1eb391f135 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -866,6 +866,11 @@ its functions. *** A new user option 'doc-view-pdftotext-program-args' has been added to allow controlling how the conversion to text is done. ++++ +*** The prefix key 's' was changed to 'c' for slicing commands +to avoid conflicts with image-mode key 's'. The new key 'c' still +has good mnemonics of "cut", "clip", "crop". + ** Ido --- @@ -3523,12 +3528,32 @@ functions. *** 'image-mode' now uses this library to automatically rotate images according to the orientation in the Exif data, if any. ++++ +*** The command 'image-rotate' now accepts a prefix argument. +With a prefix argument, 'image-rotate' now rotates the image at point +90 degrees counter-clockwise, instead of the default clockwise. + +++ *** In 'image-mode' the image is resized automatically to fit in window. By default, the image will resize upon first display and whenever the window's dimensions change. Two user options 'image-auto-resize' and 'image-auto-resize-on-window-resize' control the resizing behavior -(including the possibility to disable auto-resizing). +(including the possibility to disable auto-resizing). A new key +prefix 's' contains the commands that can be used to fit the image to +the window manually. + +--- +*** Some 'image-mode' variables are now buffer-local. +The image parameters 'image-transform-rotation', +'image-transform-scale' and 'image-transform-resize' are now declared +buffer-local, so each buffer could have its own values for these +parameters. + ++++ +*** Three new 'image-mode' commands have been added: 'm', which marks +the file in the dired buffer(s) for the directory the file is in; 'u', +which unmarks the file; and 'w', which pushes the current buffer's file +name to the kill ring. --- *** New library image-converter. @@ -3549,26 +3574,6 @@ These now default to using 'image-mode'. some years back. It now respects 'imagemagick-types-inhibit' as a way to disable that. ---- -*** Some 'image-mode' variables are now buffer-local. -The image parameters 'image-transform-rotation', -'image-transform-scale' and 'image-transform-resize' are now declared -buffer-local, so each buffer could have its own values for these -parameters. - -+++ -*** Three new 'image-mode' commands have been added: 'm', which marks -the file in the dired buffer(s) for the directory the file is in; 'u', -which unmarks the file; and 'w', which pushes the current buffer's file -name to the kill ring. - -+++ -*** The command 'image-rotate' now accepts a prefix argument. -With a prefix argument, 'image-rotate' now rotates the image at point -90 degrees counter-clockwise, instead of the default clockwise. - -*** 'image-mode' has a new key prefix 's' for transformation commands. - ** Modules --- diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 8dd0d93071..714fdf8b08 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -59,16 +59,16 @@ ;; will be remembered and applied to all pages of the current ;; document. This enables you to cut away the margins of a document ;; to save some space. To select a slice you can use -;; `doc-view-set-slice' (bound to `s s') which will query you for the +;; `doc-view-set-slice' (bound to `c s') which will query you for the ;; coordinates of the slice's top-left corner and its width and ;; height. A much more convenient way to do the same is offered by -;; the command `doc-view-set-slice-using-mouse' (bound to `s m'). +;; the command `doc-view-set-slice-using-mouse' (bound to `c m'). ;; After invocation you only have to press mouse-1 at the top-left ;; corner and drag it to the bottom-right corner of the desired slice. ;; Even more accurate and convenient is to use -;; `doc-view-set-slice-from-bounding-box' (bound to `s b') which uses +;; `doc-view-set-slice-from-bounding-box' (bound to `c b') which uses ;; the BoundingBox information of the current page to set an optimal -;; slice. To reset the slice use `doc-view-reset-slice' (bound to `s +;; slice. To reset the slice use `doc-view-reset-slice' (bound to `c ;; r'). ;; ;; You can also search within the document. The command `doc-view-search' @@ -433,10 +433,10 @@ Typically \"page-%s.png\".") ;; Killing the buffer (and the process) (define-key map (kbd "K") 'doc-view-kill-proc) ;; Slicing the image - (define-key map (kbd "s s") 'doc-view-set-slice) - (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) - (define-key map (kbd "s b") 'doc-view-set-slice-from-bounding-box) - (define-key map (kbd "s r") 'doc-view-reset-slice) + (define-key map (kbd "c s") 'doc-view-set-slice) + (define-key map (kbd "c m") 'doc-view-set-slice-using-mouse) + (define-key map (kbd "c b") 'doc-view-set-slice-from-bounding-box) + (define-key map (kbd "c r") 'doc-view-reset-slice) ;; Searching (define-key map (kbd "C-s") 'doc-view-search) (define-key map (kbd "") 'doc-view-search) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 6ce4e74c7e..08f04f1d7f 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -452,12 +452,12 @@ call." ;; Transformation keys (define-key map "sf" 'image-mode-fit-frame) - (define-key map "sb" 'image-transform-fit-both) (define-key map "sh" 'image-transform-fit-to-height) (define-key map "sw" 'image-transform-fit-to-width) + (define-key map "sb" 'image-transform-fit-both) + (define-key map "ss" 'image-transform-set-scale) (define-key map "sr" 'image-transform-set-rotation) (define-key map "s0" 'image-transform-reset) - (define-key map "ss" 'image-transform-set-scale) ;; Multi-frame keys (define-key map (kbd "RET") 'image-toggle-animation) @@ -512,6 +512,8 @@ call." :help "Resize image to match the window width"] ["Fit to Window Height and Width" image-transform-fit-both :help "Resize image to match the window height and width"] + ["Set Scale..." image-transform-set-scale + :help "Resize image by specified scale factor"] ["Rotate Image..." image-transform-set-rotation :help "Rotate the image"] ["Reset Transformations" image-transform-reset commit 400ff5cd195e81204edd9c69fa1b8bc3cb66b42d Author: Paul Eggert Date: Wed Apr 22 10:42:09 2020 -0700 Improve wording about constants Thanks to Štěpán Němec and Drew Adams for reviews of recent changes. * doc/lispref/eval.texi (Quoting): Give an example. * doc/lispref/lists.texi (Association Lists): Simplify example code. * doc/lispref/objects.texi (Lisp Data Types) (Constants and Mutability): Clarify wording. diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 021604c514..baddce4d9c 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -606,6 +606,12 @@ Here are some examples of expressions that use @code{quote}: @end group @end example + Although the expressions @code{(list '+ 1 2)} and @code{'(+ 1 2)} +both yield lists equal to @code{(+ 1 2)}, the former yields a +freshly-minted mutable list whereas the latter yields a constant list +built from conses that may be shared with other constants. +@xref{Constants and Mutability}. + Other quoting constructs include @code{function} (@pxref{Anonymous Functions}), which causes an anonymous lambda expression written in Lisp to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 1125af7bec..ea44e01f48 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1625,10 +1625,9 @@ keys may not be symbols: '(("simple leaves" . oak) ("compound leaves" . horsechestnut))) -;; @r{The @code{copy-sequence} means the keys are not @code{eq}.} -(assq (copy-sequence "simple leaves") leaves) - @result{} nil -(assoc (copy-sequence "simple leaves") leaves) +(assq "simple leaves" leaves) + @result{} @r{Unspecified; might be @code{nil} or non-@code{nil}.} +(assoc "simple leaves" leaves) @result{} ("simple leaves" . oak) @end smallexample @end defun diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index abd258eb53..1eda94ab63 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -46,7 +46,7 @@ you store in it, type and all. (Actually, a small number of Emacs Lisp variables can only take on values of a certain type. @xref{Variables with Restricted Values}.) - Some Lisp objects are @dfn{constant}: their values never change. + Some Lisp objects are @dfn{constant}: their values should never change. Others are @dfn{mutable}: their values can be changed via destructive operations that involve side effects. @@ -2384,22 +2384,28 @@ that for two strings to be equal, they have the same text properties. @cindex constants @cindex mutable objects - Some Lisp objects are constant: their values never change. + Some Lisp objects are constant: their values should never change +during a single execution of Emacs running well-behaved Lisp code. For example, you can create a new integer by calculating one, but you cannot modify the value of an existing integer. - Other Lisp objects are mutable: their values can be changed + Other Lisp objects are mutable: it is safe to change their values via destructive operations involving side effects. For example, an existing marker can be changed by moving the marker to point to somewhere else. - Although numbers are always constants and markers are always + Although all numbers are constants and all markers are mutable, some types contain both constant and mutable members. These types include conses, vectors, strings, and symbols. For example, the string literal @code{"aaa"} yields a constant string, whereas the function call @code{(make-string 3 ?a)} yields a mutable string that can be changed via later calls to @code{aset}. + A mutable object can become constant if it is passed to the +@code{eval} function, because a program should not modify an object +that is being evaluated. The reverse does not occur: constant objects +should stay constant. + Trying to modify a constant variable signals an error (@pxref{Constant Variables}). A program should not attempt to modify other types of constants because the @@ -2407,9 +2413,10 @@ resulting behavior is undefined: the Lisp interpreter might or might not detect the error, and if it does not detect the error the interpreter can behave unpredictably thereafter. Another way to put this is that although mutable objects are safe to change and constant -symbols reliably reject attempts to change them, other constants are -not safely mutable: if you try to change one your program might -behave as you expect but it might crash or worse. This problem occurs +variables reliably prevent attempts to change them, other constants +are not safely mutable: if a misbehaving program tries to change such a +constant then the constant's value might actually change, or the +program might crash or worse. This problem occurs with types that have both constant and mutable members, and that have mutators like @code{setcar} and @code{aset} that are valid on mutable objects but hazardous on constants. commit d2836fe71b30dedb39a8d6e1b1705cece30dcf63 Author: Tassilo Horn Date: Wed Apr 22 19:23:23 2020 +0200 Improve the default value of 'doc-view-ghostscript-program'. * lisp/doc-view.el (doc-view-ghostscript-program): On Windows, try gswin64c, gswin32c, rungs, and mgs. (Bug#36357) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 3788d79725..8dd0d93071 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -155,9 +155,21 @@ (defcustom doc-view-ghostscript-program (cond ((memq system-type '(windows-nt ms-dos)) - "gswin32c") - (t - "gs")) + (or + ;; Windows Ghostscript + (executable-find "gswin64c") + (executable-find "gswin32c") + ;; The GS wrapper coming with TeX Live + (executable-find "rungs") + ;; The MikTeX builtin GS Check if mgs is functional for external + ;; non-MikTeX apps. Was available under: + ;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx + (when-let ((mgs (executable-find "mgs"))) + (when (= 0 (shell-command + (concat (shell-quote-argument mgs) + " -q -dNODISPLAY -c quit"))) + mgs)))) + (t "gs")) "Program to convert PS and PDF files to PNG." :type 'file :version "27.1") commit fc55f65305e855b31a8594764cfadfb5bf0f107f Author: Eli Zaretskii Date: Tue Apr 21 16:50:13 2020 +0300 Minor improvements in documentation of the last change * etc/NEWS: * doc/emacs/files.texi (Image Mode): Minor copyedits of last change. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 8d75b569ed..7318667403 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2126,11 +2126,14 @@ and displaying it in hex representation. Displaying the file as an image works only if Emacs is compiled with support for displaying such images. -If the displayed image is wider or taller than the frame, the usual -point motion keys (@kbd{C-f}, @kbd{C-p}, and so forth) cause different -parts of the image to be displayed. But by default the image is -resized automatically to fit to the window. You can configure this by -using two options @code{image-auto-resize} and +@vindex image-auto-resize +@vindex image-auto-resize-on-window-resize +If the displayed image is wider or taller than the window in which it +is displayed, the usual point motion keys (@kbd{C-f}, @kbd{C-p}, and +so forth) cause different parts of the image to be displayed. +However, by default images are resized automatically to fit the +window, so this is only necessary if you customize the default +behavior by using the options @code{image-auto-resize} and @code{image-auto-resize-on-window-resize}. You can press @kbd{n} (@code{image-next-file}) and @kbd{p} diff --git a/etc/NEWS b/etc/NEWS index 1d630a3e91..65ac6d2a2f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3525,10 +3525,10 @@ according to the orientation in the Exif data, if any. +++ *** In 'image-mode' the image is resized automatically to fit in window. -The image will resize upon first display and whenever the window's -dimensions change. Two user options 'image-auto-resize' and -'image-auto-resize-on-window-resize' can define resizing parameters or -disable auto-resizing. +By default, the image will resize upon first display and whenever the +window's dimensions change. Two user options 'image-auto-resize' and +'image-auto-resize-on-window-resize' control the resizing behavior +(including the possibility to disable auto-resizing). --- *** New library image-converter. commit a64da75961fbce7dc071af37058de710bb13c26e Author: Juri Linkov Date: Tue Apr 21 02:42:16 2020 +0300 Add image-auto-resize defcustoms to image-mode.el * lisp/image-mode.el (image-auto-resize) (image-auto-resize-on-window-resize): New defcustoms. (image-mode-map): Bind "sb" to image-transform-fit-both. (image-mode): Set image-transform-resize to image-auto-resize initially. (image-mode--setup-mode): Add hook on image-auto-resize-on-window-resize. (image-toggle-display-image): Check if image-transform-resize is t. (image-transform-properties): Check image-transform-resize for nil and t. (image-transform-fit-both): New command. (image-transform-reset): Reset image-transform-resize to image-auto-resize. * doc/emacs/files.texi (Image Mode): Mention image-auto-resize and image-auto-resize-on-window-resize. https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg01160.html diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 7d57555ce3..8d75b569ed 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -2122,12 +2122,18 @@ to toggle between displaying the file as an image in the Emacs buffer, and displaying its underlying text (or raw byte) representation. Additionally you can type @kbd{C-c C-x} (@code{image-toggle-hex-display}) to toggle between displaying the file as an image in the Emacs buffer, -and displaying it in hex representation. -Displaying the file as an image works only if Emacs is compiled with -support for displaying such images. If the displayed image is wider -or taller than the frame, the usual point motion keys (@kbd{C-f}, -@kbd{C-p}, and so forth) cause different parts of the image to be -displayed. You can press @kbd{n} (@code{image-next-file}) and @kbd{p} +and displaying it in hex representation. Displaying the file as an +image works only if Emacs is compiled with support for displaying +such images. + +If the displayed image is wider or taller than the frame, the usual +point motion keys (@kbd{C-f}, @kbd{C-p}, and so forth) cause different +parts of the image to be displayed. But by default the image is +resized automatically to fit to the window. You can configure this by +using two options @code{image-auto-resize} and +@code{image-auto-resize-on-window-resize}. + +You can press @kbd{n} (@code{image-next-file}) and @kbd{p} (@code{image-previous-file}) to visit the next image file and the previous image file in the same directory, respectively. diff --git a/etc/NEWS b/etc/NEWS index fe8a8d8775..1d630a3e91 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3523,9 +3523,12 @@ functions. *** 'image-mode' now uses this library to automatically rotate images according to the orientation in the Exif data, if any. ++++ *** In 'image-mode' the image is resized automatically to fit in window. The image will resize upon first display and whenever the window's -dimensions change. +dimensions change. Two user options 'image-auto-resize' and +'image-auto-resize-on-window-resize' can define resizing parameters or +disable auto-resizing. --- *** New library image-converter. diff --git a/lisp/image-mode.el b/lisp/image-mode.el index fbce1193cd..6ce4e74c7e 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -53,11 +53,38 @@ See `image-mode-winprops'.") "Special hook run when image data is requested in a new window. It is called with one argument, the initial WINPROPS.") +(defcustom image-auto-resize t + "Non-nil to resize the image upon first display. +Its value should be one of the following: + - nil, meaning no resizing. + - t, meaning to fit the image to the window height and width. + - `fit-height', meaning to fit the image to the window height. + - `fit-width', meaning to fit the image to the window width. + - A number, which is a scale factor (the default size is 1)." + :type '(choice (const :tag "No resizing" nil) + (other :tag "Fit height and width" t) + (const :tag "Fit height" fit-height) + (const :tag "Fit width" fit-width) + (number :tag "Scale factor" 1)) + :version "27.1" + :group 'image) + +(defcustom image-auto-resize-on-window-resize 1 + "Non-nil to resize the image whenever the window's dimensions change. +This will always keep the image fit to the window. +When non-nil, the value should be a number of seconds to wait before +resizing according to the value specified in `image-auto-resize'." + :type '(choice (const :tag "No auto-resize on window size change" nil) + (integer :tag "Wait for number of seconds before resize" 1)) + :version "27.1" + :group 'image) + ;; FIXME this doesn't seem mature yet. Document in manual when it is. (defvar-local image-transform-resize nil "The image resize operation. Its value should be one of the following: - nil, meaning no resizing. + - t, meaning to fit the image to the window height and width. - `fit-height', meaning to fit the image to the window height. - `fit-width', meaning to fit the image to the window width. - A number, which is a scale factor (the default size is 1).") @@ -425,6 +452,7 @@ call." ;; Transformation keys (define-key map "sf" 'image-mode-fit-frame) + (define-key map "sb" 'image-transform-fit-both) (define-key map "sh" 'image-transform-fit-to-height) (define-key map "sw" 'image-transform-fit-to-width) (define-key map "sr" 'image-transform-set-rotation) @@ -482,6 +510,8 @@ call." :help "Resize image to match the window height"] ["Fit to Window Width" image-transform-fit-to-width :help "Resize image to match the window width"] + ["Fit to Window Height and Width" image-transform-fit-both + :help "Resize image to match the window height and width"] ["Rotate Image..." image-transform-set-rotation :help "Rotate the image"] ["Reset Transformations" image-transform-reset @@ -569,6 +599,7 @@ Key bindings: (major-mode-suspend) (setq major-mode 'image-mode) + (setq image-transform-resize image-auto-resize) (if (not (image-get-display-property)) (progn @@ -611,7 +642,8 @@ Key bindings: (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t) (add-hook 'after-revert-hook #'image-after-revert-hook nil t) - (add-hook 'window-state-change-functions #'image--window-state-change nil t) + (when image-auto-resize-on-window-resize + (add-hook 'window-state-change-functions #'image--window-state-change nil t)) (run-mode-hooks 'image-mode-hook) (let ((image (image-get-display-property)) @@ -768,7 +800,7 @@ was inserted." filename)) ;; If we have a `fit-width' or a `fit-height', don't limit ;; the size of the image to the window size. - (edges (and (null image-transform-resize) + (edges (and (eq image-transform-resize t) (window-inside-pixel-edges (get-buffer-window)))) (type (if (image--imagemagick-wanted-p filename) 'imagemagick @@ -878,7 +910,9 @@ Otherwise, display the image by calling `image-mode'." ;; image resizing happens later during redisplay. So if those ;; consecutive calls happen without any redisplay between them, ;; the costly operation of image resizing should happen only once. - (run-with-idle-timer 1 nil #'image-fit-to-window window)) + (when (numberp image-auto-resize-on-window-resize) + (run-with-idle-timer image-auto-resize-on-window-resize nil + #'image-fit-to-window window))) (defun image-fit-to-window (window) "Adjust size of image to display it exactly in WINDOW boundaries." @@ -1282,7 +1316,7 @@ These properties are determined by the Image mode variables `image-transform-resize' and `image-transform-rotation'. The return value is suitable for appending to an image spec." (setq image-transform-scale 1.0) - (when (or image-transform-resize + (when (or (not (memq image-transform-resize '(nil t))) (/= image-transform-rotation 0.0)) ;; Note: `image-size' looks up and thus caches the untransformed ;; image. There's no easy way to prevent that. @@ -1328,6 +1362,12 @@ return value is suitable for appending to an image spec." (setq image-transform-resize 'fit-width) (image-toggle-display-image)) +(defun image-transform-fit-both () + "Fit the current image both to the height and width of the current window." + (interactive) + (setq image-transform-resize t) + (image-toggle-display-image)) + (defun image-transform-set-rotation (rotation) "Prompt for an angle ROTATION, and rotate the image by that amount. ROTATION should be in degrees." @@ -1338,7 +1378,7 @@ ROTATION should be in degrees." (defun image-transform-reset () "Display the current image with the default size and rotation." (interactive) - (setq image-transform-resize nil + (setq image-transform-resize image-auto-resize image-transform-rotation 0.0 image-transform-scale 1) (image-toggle-display-image)) commit 692ad40539805e435a16b90067fa5917e4fea9f8 Author: Juri Linkov Date: Tue Apr 21 02:23:35 2020 +0300 Improve the documentation of tab-bar and tab-line * doc/emacs/frames.texi (Tab Bars): Add xref to "Tab Line". Document more commands. * doc/emacs/windows.texi (Windows): * doc/emacs/emacs.texi (Top): Add "Tab Line" menu. * doc/emacs/windows.texi (Window Convenience): Move tab-line documentation to new node "Tab Line". (Tab Line): New node. * doc/emacs/glossary.texi (Glossary): * doc/emacs/modes.texi (Minor Modes): * doc/emacs/display.texi (Standard Faces): Add xref to "Tab Line". diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 4273357995..d98441b5ab 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -735,6 +735,7 @@ in a way that does not interact well with @code{highlight}. @cindex @code{tab-line} face Similar to @code{mode-line} for a window's tab line, which appears at the top of a window with tabs representing window buffers. +@xref{Tab Line}. @item vertical-border @cindex @code{vertical-border} face This face is used for the vertical divider between windows on text diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 60f2be9a51..6b82aeb823 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -517,6 +517,7 @@ Multiple Windows * Displaying Buffers:: How Emacs picks a window for displaying a buffer. * Temporary Displays:: Displaying non-editable buffers. * Window Convenience:: Convenience functions for window handling. +* Tab Line:: Window tab line. Displaying a Buffer in a Window diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 94218424d3..d9373b8bc7 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1262,6 +1262,12 @@ sessions (@pxref{Saving Emacs Sessions}), the tabs from the Tab Bar are recorded in the desktop file, together with their associated window configurations, and will be available after restoring the session. +Note that the Tab Bar is different from the Tab Line (@pxref{Tab Line}). +Whereas tabs on the Tab Line at the top of each window are used to +switch between buffers, tabs on the Tab Bar at the top of each frame +are used to switch between window configurations containing several +windows. + @findex tab-bar-mode To toggle the use of tab bars, type @kbd{M-x tab-bar-mode}. This command applies to all frames, including frames yet to be created. To @@ -1275,9 +1281,11 @@ is turned on automatically. If the value is @code{t}, then tabs. The value @code{1} hides the tab bar when it has only one tab, and shows it again when more tabs are created. The value @code{nil} always keeps the tab bar hidden; in this case it's still possible to -use persistent named window configurations without using the tab bar -by typing the related commands: @kbd{M-x tab-new}, @kbd{M-x tab-next}, -@kbd{M-x tab-close}, @kbd{M-x tab-switcher}, etc. +switch between named window configurations without the tab bar by +using @kbd{M-x tab-next}, @kbd{M-x tab-switcher}, and other commands +that provide completion on tab names. Also it's possible to create +and close tabs without the tab bar by using commands @kbd{M-x +tab-new}, @kbd{M-x tab-close}, etc. @kindex C-x t The prefix key @kbd{C-x t} is analogous to @kbd{C-x 5}. @@ -1286,7 +1294,8 @@ Whereas each @kbd{C-x 5} command pops up a buffer in a different frame tab with a different window configuration in the selected frame. The various @kbd{C-x t} commands differ in how they find or create the -buffer to select: +buffer to select. The following commands can be used to select a buffer +in a new tab: @table @kbd @item C-x t 2 @@ -1295,19 +1304,18 @@ buffer to select: Add a new tab (@code{tab-new}). You can control the choice of the buffer displayed in a new tab by customizing the variable @code{tab-bar-new-tab-choice}. + @item C-x t b @var{bufname} @key{RET} Select buffer @var{bufname} in another tab. This runs @code{switch-to-buffer-other-tab}. + @item C-x t f @var{filename} @key{RET} Visit file @var{filename} and select its buffer in another tab. This runs @code{find-file-other-tab}. @xref{Visiting}. + @item C-x t d @var{directory} @key{RET} Select a Dired buffer for directory @var{directory} in another tab. This runs @code{dired-other-tab}. @xref{Dired}. -@item C-x t r @var{tabname} @key{RET} -Renames the current tab to @var{tabname}. You can control the -programmatic name given to a tab by default by customizing the -variable @code{tab-bar-tab-name-function}. @end table @vindex tab-bar-new-tab-choice @@ -1316,7 +1324,7 @@ current before calling the command that adds a new tab. To start a new tab with other buffers, customize the variable @code{tab-bar-new-tab-choice}. - The following commands are used to delete and operate on tabs: + The following commands can be used to delete tabs: @table @kbd @item C-x t 0 @@ -1325,19 +1333,45 @@ To start a new tab with other buffers, customize the variable Close the selected tab (@code{tab-close}). It has no effect if there is only one tab. +@item C-x t 1 +@kindex C-x t 1 +@findex tab-close-other +Close all tabs on the selected frame, except the selected one. +@end table + + The following commands can be used to switch between tabs: + +@table @kbd @item C-x t o +@itemx C-@key{TAB} @kindex C-x t o @kindex C-TAB @findex tab-next -Switch to another tab. If you repeat this command, it cycles through +Switch to the next tab. If you repeat this command, it cycles through all the tabs on the selected frame. With a positive numeric argument N, it switches to the next Nth tab; with a negative argument −N, it switches back to the previous Nth tab. -@item C-x t 1 -@kindex C-x t 1 -@findex tab-close-other -Close all tabs on the selected frame, except the selected one. +@item S-C-@key{TAB} +@kindex S-C-TAB +@findex tab-previous +Switch to the previous tab. With a positive numeric argument N, it +switches to the previous Nth tab; with a negative argument −N, it +switches back to the next Nth tab. +@end table + + The following commands can be used to operate on tabs: + +@table @kbd +@item C-x t r @var{tabname} @key{RET} +Rename the current tab to @var{tabname}. You can control the +programmatic name given to a tab by default by customizing the +variable @code{tab-bar-tab-name-function}. + +@item C-x t m +Move the current tab N positions to the right with a positive numeric +argument N. With a negative argument −N, it moves the current tab +N positions to the left. @end table @node Dialog Boxes diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 416431b8cd..4d622ec0e3 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi @@ -1367,7 +1367,7 @@ configurations. @xref{Tab Bars}. @item Tab Line The tab line is a line of tabs at the top of an Emacs window. -Clicking on one of these tabs switches window buffers. +Clicking on one of these tabs switches window buffers. @xref{Tab Line}. @anchor{Glossary---Tags Table} @item Tags Table diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index a15aa17a66..dceb8d3ca5 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -791,7 +791,7 @@ the same number of columns as provided by the shell. @vindex shell-command-prompt-show-cwd To make the above commands show the current directory in their prompts, customize the variable @code{shell-command-prompt-show-cwd} -to a non-nil value. +to a non-@code{nil} value. @kindex M-| @findex shell-command-on-region diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index 92d60d2d7c..f5fb6b1e79 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi @@ -299,7 +299,7 @@ Bars}. Tab Bar mode gives each frame a tab bar. @xref{Tab Bars}. @item -Tab Line mode gives each window a tab line. +Tab Line mode gives each window a tab line. @xref{Tab Line}. @item Transient Mark mode highlights the region, and makes many Emacs diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 910ef8fd88..cb5e9bce4d 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -21,6 +21,7 @@ one frame. * Change Window:: Deleting windows and changing their sizes. * Displaying Buffers:: How Emacs picks a window for displaying a buffer. * Window Convenience:: Convenience functions for window handling. +* Tab Line:: Window tab line. @end menu @node Basic Window @@ -542,16 +543,6 @@ Reference Manual}), and cannot exceed the size of the containing frame. @node Window Convenience @section Convenience Features for Window Handling -@findex global-tab-line-mode -@cindex tab line - The command @code{global-tab-line-mode} toggles the display of a -@dfn{tab line} on the top screen line of each window. The tab line -shows special buttons (``tabs'') for each buffer that was displayed in -a window, and allows switching to any of these buffers by clicking the -corresponding button. You can add a tab by clicking on the @kbd{+} -icon and delete a tab by clicking on the @kbd{x} icon of a tab. The -mouse wheel on the tab line scrolls the tabs horizontally. - @findex winner-mode @vindex winner-dont-bind-my-keys @vindex winner-ring-size @@ -616,3 +607,29 @@ shown in different windows. @xref{Comparing Files}. Scroll All mode (@kbd{M-x scroll-all-mode}) is a global minor mode that causes scrolling commands and point motion commands to apply to every single window. + + +@node Tab Line +@section Window Tab Line + +@findex global-tab-line-mode +@cindex tab line + The command @code{global-tab-line-mode} toggles the display of +a @dfn{tab line} on the top screen line of each window. The Tab Line +shows special buttons (``tabs'') for each buffer that was displayed in +a window, and allows switching to any of these buffers by clicking the +corresponding button. Clicking on the @kbd{+} icon adds a new buffer +to the window-local tab line of buffers, and clicking on the @kbd{x} +icon of a tab deletes it. The mouse wheel on the tab line scrolls +the tabs horizontally. + +Selecting the previous window-local tab is the same as typing @kbd{C-x +@key{LEFT}} (@code{previous-buffer}), selecting the next tab is the +same as @kbd{C-x @key{RIGHT}} (@code{next-buffer}). Both commands +support a numeric prefix argument as a repeat count. + +Note that the Tab Line is different from the Tab Bar (@pxref{Tab Bars}). +Whereas tabs on the Tab Bar at the top of each frame are used to +switch between window configurations containing several windows, +tabs on the Tab Line at the top of each window are used to switch +between buffers. diff --git a/etc/NEWS b/etc/NEWS index 091c831e9d..fe8a8d8775 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2720,8 +2720,8 @@ left to higher-level functions. +++ *** Tab Bar mode The new command 'tab-bar-mode' enables the tab bar at the top of each -frame, where you can use tabs to switch between named persistent -window configurations. +frame (including TTY frames), where you can use tabs to switch between +named persistent window configurations. The 'C-x t' sequence is the new prefix key for tab-related commands: 'C-x t 2' creates a new tab; 'C-x t 0' deletes the current tab; @@ -2738,6 +2738,11 @@ when its value is "on", "yes" or "1". The user option 'tab-bar-position' specifies where to show the tab bar. +Tab-related commands can be used even without the tab bar when +'tab-bar-mode' is disabled by a nil value of the user option +'tab-bar-show'. Without the tab bar you can switch between tabs +using completion on tab names, or using 'tab-switcher'. + Read the new Info node "(emacs) Tab Bars" for full description of all related features. @@ -2752,6 +2757,9 @@ a repeat count. Clicking on the plus icon adds a new buffer to the window-local tab line of buffers. Using the mouse wheel on the tab line scrolls tabs. +Read the new Info node "(emacs) Tab Line" for full description +of all related features. + +++ ** fileloop.el lets one setup multifile operations like search&replace.