commit 9d829b8be5b86668d5165b9d0c0cdc392b558dd3 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sat Oct 5 21:23:15 2019 -0700 Fix off-by-one bug in ISO 8601 BC years * lisp/calendar/iso8601.el (iso8601--year-match) (iso8601--full-date-match, iso8601--without-day-match) (iso8601--week-date-match, iso8601--ordinal-date-match) (iso8601-parse-date): Don’t bother to separate the year’s sign from the year, as that distinction is not needed: ISO 8601 uses astronomical year numbering with a year zero, which is what the Emacs time functions use, so there’s no need to treat nonpositive years specially. (iso8601--adjust-year): Remove; no longer needed since callers can just use string-to-number. * test/lisp/calendar/iso8601-tests.el (test-iso8601-date-years): Adjust test case to match fixed behavior. diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index 78a94d47be..72929bdd7a 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -62,17 +62,17 @@ regexps "\\|")) (defconst iso8601--year-match - "\\([+-]\\)?\\([0-9][0-9][0-9][0-9]\\)") + "\\([+-]?[0-9][0-9][0-9][0-9]\\)") (defconst iso8601--full-date-match - "\\([+-]\\)?\\([0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)") + "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)") (defconst iso8601--without-day-match - "\\([+-]\\)?\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)") + "\\([+-]?[0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)") (defconst iso8601--outdated-date-match "--\\([0-9][0-9]\\)-?\\([0-9][0-9]\\)") (defconst iso8601--week-date-match - "\\([+-]\\)?\\([0-9][0-9][0-9][0-9]\\)-?W\\([0-9][0-9]\\)-?\\([0-9]\\)?") + "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?W\\([0-9][0-9]\\)-?\\([0-9]\\)?") (defconst iso8601--ordinal-date-match - "\\([+-]\\)?\\([0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9][0-9]\\)") + "\\([+-]?[0-9][0-9][0-9][0-9]\\)-?\\([0-9][0-9][0-9]\\)") (defconst iso8601--date-match (iso8601--concat-regexps (list iso8601--year-match @@ -145,21 +145,18 @@ See `decode-time' for the meaning of FORM." ;; Just a year: [+-]YYYY. ((iso8601--match iso8601--year-match string) (iso8601--decoded-time - :year (iso8601--adjust-year (match-string 1 string) - (match-string 2 string)))) + :year (string-to-number string))) ;; Calendar dates: YYYY-MM-DD and variants. ((iso8601--match iso8601--full-date-match string) (iso8601--decoded-time - :year (iso8601--adjust-year (match-string 1 string) - (match-string 2 string)) - :month (match-string 3 string) - :day (match-string 4 string))) + :year (string-to-number (match-string 1 string)) + :month (match-string 2 string) + :day (match-string 3 string))) ;; Calendar date without day: YYYY-MM. ((iso8601--match iso8601--without-day-match string) (iso8601--decoded-time - :year (iso8601--adjust-year (match-string 1 string) - (match-string 2 string)) - :month (match-string 3 string))) + :year (string-to-number string) + :month (match-string 2 string))) ;; Outdated date without year: --MM-DD ((iso8601--match iso8601--outdated-date-match string) (iso8601--decoded-time @@ -167,11 +164,10 @@ See `decode-time' for the meaning of FORM." :day (match-string 2 string))) ;; Week dates: YYYY-Www-D ((iso8601--match iso8601--week-date-match string) - (let* ((year (iso8601--adjust-year (match-string 1 string) - (match-string 2 string))) - (week (string-to-number (match-string 3 string))) - (day-of-week (and (match-string 4 string) - (string-to-number (match-string 4 string)))) + (let* ((year (string-to-number string)) + (week (string-to-number (match-string 2 string))) + (day-of-week (and (match-string 3 string) + (string-to-number (match-string 3 string)))) (jan-start (decoded-time-weekday (decode-time (iso8601--encode-time @@ -199,9 +195,8 @@ See `decode-time' for the meaning of FORM." :day (decoded-time-day month-day))))) ;; Ordinal dates: YYYY-DDD ((iso8601--match iso8601--ordinal-date-match string) - (let* ((year (iso8601--adjust-year (match-string 1 string) - (match-string 2 string))) - (ordinal (string-to-number (match-string 3 string))) + (let* ((year (string-to-number (match-string 1 string))) + (ordinal (string-to-number (match-string 2 string))) (month-day (date-ordinal-to-time year ordinal))) (iso8601--decoded-time :year year :month (decoded-time-month month-day) @@ -209,16 +204,6 @@ See `decode-time' for the meaning of FORM." (t (signal 'wrong-type-argument string)))) -(defun iso8601--adjust-year (sign year) - (save-match-data - (let ((year (if (stringp year) - (string-to-number year) - year))) - (if (string= sign "-") - ;; -0001 is 2 BCE. - (1- (- year)) - year)))) - (defun iso8601-parse-time (string &optional form) "Parse STRING, which should be an ISO 8601 time string. The return value will be a `decode-time' structure with just the diff --git a/test/lisp/calendar/iso8601-tests.el b/test/lisp/calendar/iso8601-tests.el index b5a3c9538d..cc18d0702d 100644 --- a/test/lisp/calendar/iso8601-tests.el +++ b/test/lisp/calendar/iso8601-tests.el @@ -26,7 +26,7 @@ (should (equal (iso8601-parse-date "1985") '(nil nil nil nil nil 1985 nil nil nil))) (should (equal (iso8601-parse-date "-0003") - '(nil nil nil nil nil -4 nil nil nil))) + '(nil nil nil nil nil -3 nil nil nil))) (should (equal (iso8601-parse-date "+1985") '(nil nil nil nil nil 1985 nil nil nil)))) commit aadf72167673c8702531ba3802e3d5f137f139ba Author: Paul Eggert Date: Sat Oct 5 21:17:48 2019 -0700 Improve documentation for year-zero issues * doc/emacs/calendar.texi (Calendar Systems) * doc/lispref/os.texi (Time Conversion): Prefer "BC" to "B.C." since the documentation generally uses "BC". * doc/misc/emacs-mime.texi (time-date): * lisp/calendar/time-date.el (date-to-day, time-to-days): In the doc string, state the day origin more clearly, and more consistently with the rest of the documentation. * src/timefns.c (Fdecode_time): State the year origin in the doc string. diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi index e337474d92..eaae019378 100644 --- a/doc/emacs/calendar.texi +++ b/doc/emacs/calendar.texi @@ -706,7 +706,7 @@ century. @cindex Julian day numbers @cindex astronomical day numbers Astronomers use a simple counting of days elapsed since noon, Monday, -January 1, 4713 B.C. on the Julian calendar. The number of days elapsed +January 1, 4713 BC on the Julian calendar. The number of days elapsed is called the @dfn{Julian day number} or the @dfn{Astronomical day number}. @cindex Hebrew calendar diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index fae23cb075..912d464b49 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1435,9 +1435,9 @@ the past or future. Calendrical conversion functions always use the Gregorian calendar, even for dates before the Gregorian calendar was introduced. Year numbers -count the number of years since the year 1 B.C., and do not skip zero +count the number of years since the year 1 BC, and do not skip zero as traditional Gregorian years do; for example, the year number -@minus{}37 represents the Gregorian year 38 B.C@. +@minus{}37 represents the Gregorian year 38 BC@. @defun time-convert time &optional form This function converts a time value into a Lisp timestamp. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 8a1ba969ed..53d0a62ac4 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1603,8 +1603,8 @@ An integer or floating point count of seconds. For instance: @code{905595714.0}, @code{905595714}. @item days -An integer number representing the number of days since 00000101. For -instance: @code{729644}. +An integer number representing the number of days since Sunday, +December 31, 1 BC (Gregorian). For instance: @code{729644}. @item decoded time A list of decoded time. For instance: @code{(54 21 12 12 9 1998 6 nil diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index 98dcfab015..6c8b98851e 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -381,7 +381,7 @@ ;;; These versions are rewritten to use arbitrary-size integers. ;;; A numerical date is the number of days since midnight on -;;; the morning of December 31, 1 B.C. (Gregorian) or January 2, 1 A.D. (Julian). +;;; the morning of December 31, 1 BC (Gregorian) or January 2, 1 AD (Julian). ;;; Emacs's calendar refers to such a date as an absolute date, some Calc function ;;; names also use that terminology. If the date is a non-integer, it represents ;;; a specific date and time. diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 11bd469ae3..dec153113f 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -197,8 +197,9 @@ TIME should be either a time value or a date-time string." ;;;###autoload (defun date-to-day (date) - "Return the number of days between year 1 and DATE. -DATE should be a date-time string." + "Return the absolute date of DATE, a date-time string. +The absolute date is the number of days elapsed since the imaginary +Gregorian date Sunday, December 31, 1 BC." (time-to-days (date-to-time date))) ;;;###autoload @@ -233,9 +234,9 @@ DATE1 and DATE2 should be date-time strings." ;;;###autoload (defun time-to-days (time) - "The number of days between the Gregorian date 0001-12-31bce and TIME. -TIME should be a time value. -The Gregorian date Sunday, December 31, 1bce is imaginary." + "The absolute date corresponding to TIME, a time value. +The absolute date is the number of days elapsed since the imaginary +Gregorian date Sunday, December 31, 1 BC." (let* ((tim (decode-time time)) (year (decoded-time-year tim))) (+ (time-date--day-in-year tim) ; Days this year diff --git a/src/timefns.c b/src/timefns.c index 9509b6b63e..6afeca1cb3 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1491,8 +1491,8 @@ Lisp timestamp representing a nonnegative value less than 60 \(or less than 61 if the operating system supports leap seconds). MINUTE is an integer between 0 and 59. HOUR is an integer between 0 and 23. DAY is an integer between 1 and 31. MONTH is an -integer between 1 and 12. YEAR is an integer indicating the -four-digit year. DOW is the day of week, an integer between 0 and 6, +integer between 1 and 12. YEAR is the year number, an integer; 0 +represents 1 BC. DOW is the day of week, an integer between 0 and 6, where 0 is Sunday. DST is t if daylight saving time is in effect, nil if it is not in effect, and -1 if daylight saving information is not available. UTCOFF is an integer indicating the UTC offset in commit 6b915359efc24ea1262c77b9a35725929b06b08b Author: Juri Linkov Date: Sun Oct 6 00:54:46 2019 +0300 More tab bar related key bindings. * lisp/subr.el (ctl-x-6-map, ctl-x-6-prefix): Move here from tab-bar.el to make it available to other modes like dired for 'C-x 6 d'. * lisp/dired.el (dired-other-tab): New command bound to 'C-x 6 d'. * lisp/tab-bar.el: Bind 'C-x 6 o' to tab-next. * doc/emacs/frames.texi (Tab Bars): Describe C-x 6 prefix key bindings. diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 43cdb2664d..ba1424aa2a 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1255,12 +1255,58 @@ 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-list}, @kbd{M-x tab-close}, etc. +@kindex C-x 6 + The prefix key @kbd{C-x 6} is analogous to @kbd{C-x 5}. +Whereas each @kbd{C-x 5} command pops up a buffer in a different frame +(@pxref{Creating Frames}), the @kbd{C-x 6} commands use a different +tab with a different window configuration in the selected frame. + + The various @kbd{C-x 6} commands differ in how they find or create the +buffer to select: + +@table @kbd +@item C-x 6 2 +@kindex C-x 6 2 +@findex tab-new +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 6 b @var{bufname} @key{RET} +Select buffer @var{bufname} in another tab. This runs +@code{switch-to-buffer-other-tab}. +@item C-x 6 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 6 d @var{directory} @key{RET} +Select a Dired buffer for directory @var{directory} in another tab. +This runs @code{dired-other-tab}. @xref{Dired}. +@end table + @vindex tab-bar-new-tab-choice By default, a new tab starts with the current buffer that was 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: + +@table @kbd +@item C-x 6 0 +@kindex C-x 6 0 +@findex tab-close +Close the selected tab (@code{tab-close}). It has no effect if there +is only one tab. + +@item C-x 6 o +@kindex C-x 6 o +@kindex C-TAB +@findex tab-next +Switch to another 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. +@end table + @node Dialog Boxes @section Using Dialog Boxes @cindex dialog boxes diff --git a/etc/NEWS b/etc/NEWS index cadd6d9ef4..0edbec6894 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2058,6 +2058,9 @@ tabs with a mouse. Tab-related commands are available even when the Tab-Bar mode is disabled: by default, they enable Tab-Bar mode in that case. +Read the new Info node "(emacs) Tab Bars" for full description +of all related features. + *** Tab-Line mode The new command 'global-tab-line-mode' enables the tab-line above each window, which you can use to switch buffers in the window. Selecting diff --git a/lisp/dired.el b/lisp/dired.el index 854bc9f7d7..efe00d1ba4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -835,6 +835,13 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh." (interactive (dired-read-dir-and-switches "in other frame ")) (switch-to-buffer-other-frame (dired-noselect dirname switches))) +;;;###autoload (define-key ctl-x-6-map "d" 'dired-other-tab) +;;;###autoload +(defun dired-other-tab (dirname &optional switches) + "\"Edit\" directory DIRNAME. Like `dired' but makes a new tab." + (interactive (dired-read-dir-and-switches "in other tab ")) + (switch-to-buffer-other-tab (dired-noselect dirname switches))) + ;;;###autoload (defun dired-noselect (dir-or-list &optional switches) "Like `dired' but returns the Dired buffer as value, does not select it." diff --git a/lisp/subr.el b/lisp/subr.el index 985bdc6b71..b0a9a83958 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1238,6 +1238,11 @@ The normal global definition of the character C-x indirects to this keymap.") (defalias 'ctl-x-5-prefix ctl-x-5-map) (define-key ctl-x-map "5" 'ctl-x-5-prefix) +(defvar ctl-x-6-map (make-sparse-keymap) + "Keymap for tab commands.") +(defalias 'ctl-x-6-prefix ctl-x-6-map) +(define-key ctl-x-map "6" 'ctl-x-6-prefix) + ;;;; Event manipulation functions. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index d8d9bdac26..27ae274eaa 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -793,11 +793,6 @@ in the selected frame." (tab-bar-list-select)) -(defvar ctl-x-6-map (make-sparse-keymap) - "Keymap for tab commands.") -(defalias 'ctl-x-6-prefix ctl-x-6-map) -(define-key ctl-x-map "6" 'ctl-x-6-prefix) - (defun switch-to-buffer-other-tab (buffer-or-name &optional norecord) "Switch to buffer BUFFER-OR-NAME in another tab. Like \\[switch-to-buffer-other-frame] (which see), but creates a new tab." @@ -825,6 +820,7 @@ Like \\[find-file-other-frame] (which see), but creates a new tab." (define-key ctl-x-6-map "2" 'tab-new) (define-key ctl-x-6-map "0" 'tab-close) +(define-key ctl-x-6-map "o" 'tab-next) (define-key ctl-x-6-map "b" 'switch-to-buffer-other-tab) (define-key ctl-x-6-map "f" 'find-file-other-tab) (define-key ctl-x-6-map "\C-f" 'find-file-other-tab) commit e3fcf1f38bb5900a595f441a13cf83b034701790 Author: Juri Linkov Date: Sun Oct 6 00:50:19 2019 +0300 * lisp/tab-bar.el: In tab switching allow absolute and relative args. * lisp/tab-bar.el (tab-bar-tab-hints): New defcustom. (tab-bar-make-keymap-1): Use tab-bar-tab-hints. (tab-bar--tab, tab-bar--current-tab, tab-bar--current-tab-index) (tab-bar--tab-index, tab-bar--tab-index-by-name): New internal functions. (tab-bar-select-tab): Use arg as absolute position of tab to select. (tab-bar-switch-to-next-tab, tab-bar-switch-to-prev-tab): Use arg as offset relative to the current tab. (tab-bar-switch-to-tab): New command. (tab-bar-new-tab): Simplify by using cl-pushnew. (tab-bar-close-current-tab): Remove (the current tab is closed by nil arg of tab-bar-close-tab). (tab-bar-close-tab): Use arg as absolute position of tab to close. (tab-bar-close-tab-by-name): New command. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 6d2c915aa6..d8d9bdac26 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -34,6 +34,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defgroup tab-bar nil "Frame-local tabs." @@ -179,16 +181,16 @@ keyboard commands `tab-list', `tab-new', `tab-close', `tab-next', etc." If t, start a new tab with the current buffer, i.e. the buffer that was current before calling the command that adds a new tab (this is the same what `make-frame' does by default). -If the value is a string, switch to a buffer if it exists, or switch -to a buffer visiting the file or directory that the string specifies. -If the value is a function, call it with no arguments and switch to -the buffer that it returns. +If the value is a string, use it as a buffer name switch to a buffer +if such buffer exists, or switch to a buffer visiting the file or +directory that the string specifies. If the value is a function, +call it with no arguments and switch to the buffer that it returns. If nil, duplicate the contents of the tab that was active before calling the command that adds a new tab." :type '(choice (const :tag "Current buffer" t) + (string :tag "Buffer" "*scratch*") (directory :tag "Directory" :value "~/") (file :tag "File" :value "~/.emacs") - (string :tag "Buffer" "*scratch*") (function :tag "Function") (const :tag "Duplicate tab" nil)) :group 'tab-bar @@ -233,6 +235,17 @@ If nil, don't show it at all." :help "Click to close tab") "Button for closing the clicked tab.") +(defcustom tab-bar-tab-hints nil + "Show absolute numbers on tabs in the tab bar before the tab name. +This helps to select the tab by its number using `tab-bar-select-tab'." + :type 'boolean + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "27.1") + (defvar tab-bar-separator nil) @@ -261,19 +274,20 @@ By default, use function `tab-bar-tabs'.") Ensure the frame parameter `tabs' is pre-populated. Return its existing value or a new value." (let ((tabs (frame-parameter nil 'tabs))) - (if tabs - ;; Update current tab name - (let ((name (assq 'name (assq 'current-tab tabs)))) - (when name (setcdr name (funcall tab-bar-tab-name-function)))) + (unless tabs ;; Create default tabs - (setq tabs `((current-tab (name . ,(funcall tab-bar-tab-name-function))))) + (setq tabs (list (tab-bar--current-tab))) (set-frame-parameter nil 'tabs tabs)) tabs)) (defun tab-bar-make-keymap-1 () "Generate an actual keymap from `tab-bar-map', without caching." - (let ((separator (or tab-bar-separator (if window-system " " "|"))) - (i 0)) + (let* ((separator (or tab-bar-separator (if window-system " " "|"))) + (i 0) + (tabs (funcall tab-bar-tabs-function)) + (current-tab-name (assq 'name (assq 'current-tab tabs)))) + (when current-tab-name + (setf (cdr current-tab-name) (funcall tab-bar-tab-name-function))) (append '(keymap (mouse-1 . tab-bar-handle-mouse)) (mapcan @@ -285,7 +299,8 @@ Return its existing value or a new value." ((eq (car tab) 'current-tab) `((current-tab menu-item - ,(propertize (concat (cdr (assq 'name tab)) + ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") + (cdr (assq 'name tab)) (or (and tab-bar-close-button-show (not (eq tab-bar-close-button-show 'non-selected)) @@ -296,7 +311,8 @@ Return its existing value or a new value." (t `((,(intern (format "tab-%i" i)) menu-item - ,(propertize (concat (cdr (assq 'name tab)) + ,(propertize (concat (if tab-bar-tab-hints (format "%d " i) "") + (cdr (assq 'name tab)) (or (and tab-bar-close-button-show (not (eq tab-bar-close-button-show 'selected)) @@ -304,97 +320,132 @@ Return its existing value or a new value." 'face 'tab-bar-tab-inactive) ,(or (cdr (assq 'binding tab)) - (lambda () - (interactive) - (tab-bar-select-tab tab))) + `(lambda () + (interactive) + (tab-bar-select-tab ,i))) :help "Click to visit tab")))) `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) menu-item "" ,(or (cdr (assq 'close-binding tab)) - (lambda () - (interactive) - (tab-bar-close-tab tab))))))) - (funcall tab-bar-tabs-function)) + `(lambda () + (interactive) + (tab-bar-close-tab ,i))))))) + tabs) (when tab-bar-new-button `((sep-add-tab menu-item ,separator ignore) (add-tab menu-item ,tab-bar-new-button tab-bar-new-tab :help "New tab")))))) -(defun tab-bar-read-tab-name (prompt) - (let* ((tabs (tab-bar-tabs)) - (tab-name - (completing-read prompt - (or (delq nil (mapcar (lambda (tab) - (cdr (assq 'name tab))) - tabs)) - '(""))))) +(defun tab-bar--tab () + `(tab + (name . ,(funcall tab-bar-tab-name-function)) + (time . ,(time-convert nil 'integer)) + (wc . ,(current-window-configuration)) + (ws . ,(window-state-get + (frame-root-window (selected-frame)) 'writable)))) + +(defun tab-bar--current-tab () + `(current-tab + (name . ,(funcall tab-bar-tab-name-function)))) + +(defun tab-bar--current-tab-index (&optional tabs) + ;; FIXME: could be replaced with 1-liner using seq-position + (let ((tabs (or tabs (tab-bar-tabs))) + (i 0)) (catch 'done - (dolist (tab tabs) - (when (equal (cdr (assq 'name tab)) tab-name) - (throw 'done tab)))))) - -(defun tab-bar-tab-default () - (let ((tab `(tab - (name . ,(funcall tab-bar-tab-name-function)) - (time . ,(time-convert nil 'integer)) - (wc . ,(current-window-configuration)) - (ws . ,(window-state-get - (frame-root-window (selected-frame)) 'writable))))) - tab)) - -(defun tab-bar-find-prev-tab (&optional tabs) - (unless tabs - (setq tabs (tab-bar-tabs))) - (unless (eq (car (car tabs)) 'current-tab) - (while (and tabs (not (eq (car (car (cdr tabs))) 'current-tab))) - (setq tabs (cdr tabs))) - tabs)) + (while tabs + (when (eq (car (car tabs)) 'current-tab) + (throw 'done i)) + (setq i (1+ i) tabs (cdr tabs)))))) - -(defun tab-bar-select-tab (tab) - "Switch to the specified TAB." - (interactive (list (tab-bar-read-tab-name "Select tab by name: "))) - (when (and tab (not (eq (car tab) 'current-tab))) - (let* ((tabs (tab-bar-tabs)) - (new-tab (tab-bar-tab-default)) - (wc (cdr (assq 'wc tab)))) - ;; During the same session, use window-configuration to switch - ;; tabs, because window-configurations are more reliable - ;; (they keep references to live buffers) than window-states. - ;; But after restoring tabs from a previously saved session, - ;; its value of window-configuration is unreadable, - ;; so restore its saved window-state. - (if (window-configuration-p wc) - (set-window-configuration wc) - (window-state-put (cdr (assq 'ws tab)) - (frame-root-window (selected-frame)) 'safe)) +(defun tab-bar--tab-index (tab &optional tabs) + ;; FIXME: could be replaced with 1-liner using seq-position + (let ((tabs (or tabs (tab-bar-tabs))) + (i 0)) + (catch 'done (while tabs - (cond - ((eq (car tabs) tab) - (setcar tabs `(current-tab (name . ,(funcall tab-bar-tab-name-function))))) - ((eq (car (car tabs)) 'current-tab) - (setcar tabs new-tab))) - (setq tabs (cdr tabs))) + (when (eq (car tabs) tab) + (throw 'done i)) + (setq i (1+ i) tabs (cdr tabs)))) + i)) + +(defun tab-bar--tab-index-by-name (name &optional tabs) + ;; FIXME: could be replaced with 1-liner using seq-position + (let ((tabs (or tabs (tab-bar-tabs))) + (i 0)) + (catch 'done + (while tabs + (when (equal (cdr (assq 'name (car tabs))) name) + (throw 'done i)) + (setq i (1+ i) tabs (cdr tabs)))) + i)) + + +(defun tab-bar-select-tab (&optional arg) + "Switch to the tab by its absolute position ARG in the tab bar. +When this command is bound to a numeric key (with a prefix or modifier), +calling it without an argument will translate its bound numeric key +to the numeric argument. ARG counts from 1." + (interactive "P") + (unless (integerp arg) + (let ((key (event-basic-type last-command-event))) + (setq arg (if (and (characterp key) (>= key ?1) (<= key ?9)) + (- key ?0) + 1)))) + + (let* ((tabs (tab-bar-tabs)) + (from-index (tab-bar--current-tab-index tabs)) + (to-index (1- (max 1 (min arg (length tabs)))))) + (unless (eq from-index to-index) + (let* ((from-tab (tab-bar--tab)) + (to-tab (nth to-index tabs)) + (wc (cdr (assq 'wc to-tab))) + (ws (cdr (assq 'ws to-tab)))) + + ;; During the same session, use window-configuration to switch + ;; tabs, because window-configurations are more reliable + ;; (they keep references to live buffers) than window-states. + ;; But after restoring tabs from a previously saved session, + ;; its value of window-configuration is unreadable, + ;; so restore its saved window-state. + (if (window-configuration-p wc) + (set-window-configuration wc) + (if ws (window-state-put ws (frame-root-window (selected-frame)) + 'safe))) + + (when from-index + (setf (nth from-index tabs) from-tab)) + (setf (nth to-index tabs) (tab-bar--current-tab))) + (when tab-bar-mode (force-mode-line-update))))) -(defun tab-bar-switch-to-prev-tab (&optional _arg) - "Switch to ARGth previous tab." - (interactive "p") - (let ((prev-tab (tab-bar-find-prev-tab))) - (when prev-tab - (tab-bar-select-tab (car prev-tab))))) - -(defun tab-bar-switch-to-next-tab (&optional _arg) +(defun tab-bar-switch-to-next-tab (&optional arg) "Switch to ARGth next tab." (interactive "p") + (unless (integerp arg) + (setq arg 1)) (let* ((tabs (tab-bar-tabs)) - (prev-tab (tab-bar-find-prev-tab tabs))) - (if prev-tab - (tab-bar-select-tab (car (cdr (cdr prev-tab)))) - (tab-bar-select-tab (car (cdr tabs)))))) + (from-index (or (tab-bar--current-tab-index tabs) 0)) + (to-index (mod (+ from-index arg) (length tabs)))) + (tab-bar-select-tab (1+ to-index)))) + +(defun tab-bar-switch-to-prev-tab (&optional arg) + "Switch to ARGth previous tab." + (interactive "p") + (unless (integerp arg) + (setq arg 1)) + (tab-bar-switch-to-next-tab (- arg))) + +(defun tab-bar-switch-to-tab (name) + "Switch to the tab by NAME." + (interactive (list (completing-read "Switch to tab by name: " + (mapcar (lambda (tab) + (cdr (assq 'name tab))) + (tab-bar-tabs))))) + (tab-bar-select-tab (1+ (tab-bar--tab-index-by-name name)))) (defcustom tab-bar-new-tab-to 'right @@ -411,35 +462,12 @@ If `rightmost', create as the last tab." :version "27.1") (defun tab-bar-new-tab () - "Clone the current tab to the position specified by `tab-bar-new-tab-to'." + "Add a new tab at the position specified by `tab-bar-new-tab-to'." (interactive) (let* ((tabs (tab-bar-tabs)) - ;; (i-tab (- (length tabs) (length (memq tab tabs)))) - (new-tab (tab-bar-tab-default))) - (when (and (not tab-bar-mode) - (or (eq tab-bar-show t) - (and (natnump tab-bar-show) - (>= (length tabs) tab-bar-show)))) - (tab-bar-mode 1)) - (cond - ((eq tab-bar-new-tab-to 'leftmost) - (setq tabs (cons new-tab tabs))) - ((eq tab-bar-new-tab-to 'rightmost) - (setq tabs (append tabs (list new-tab)))) - (t - (let ((prev-tab (tab-bar-find-prev-tab tabs))) - (cond - ((eq tab-bar-new-tab-to 'left) - (if prev-tab - (setcdr prev-tab (cons new-tab (cdr prev-tab))) - (setq tabs (cons new-tab tabs)))) - ((eq tab-bar-new-tab-to 'right) - (if prev-tab - (setq prev-tab (cdr prev-tab)) - (setq prev-tab tabs)) - (setcdr prev-tab (cons new-tab (cdr prev-tab)))))))) - (set-frame-parameter nil 'tabs tabs) - (tab-bar-select-tab new-tab) + (from-index (tab-bar--current-tab-index tabs)) + (from-tab (tab-bar--tab))) + (when tab-bar-new-tab-choice (delete-other-windows) ;; Create a new window to get rid of old window parameters @@ -453,8 +481,29 @@ If `rightmost', create as the last tab." (find-file-noselect tab-bar-new-tab-choice)))))) (when (buffer-live-p buffer) (switch-to-buffer buffer)))) - (unless tab-bar-mode - (message "Added new tab with the current window configuration")))) + + (when from-index + (setf (nth from-index tabs) from-tab)) + (let ((to-tab (tab-bar--current-tab)) + (to-index (pcase tab-bar-new-tab-to + ('leftmost 0) + ('rightmost (length tabs)) + ('left (1- (or from-index 1))) + ('right (1+ (or from-index 0)))))) + (setq to-index (max 0 (min (or to-index 0) (length tabs)))) + (cl-pushnew to-tab (nthcdr to-index tabs)) + (when (eq to-index 0) + ;; pushnew handles the head of tabs but not frame-parameter + (set-frame-parameter nil 'tabs tabs))) + + (when (and (not tab-bar-mode) + (or (eq tab-bar-show t) + (and (natnump tab-bar-show) + (> (length tabs) tab-bar-show)))) + (tab-bar-mode 1)) + (if tab-bar-mode + (force-mode-line-update) + (message "Added new tab at %s" tab-bar-new-tab-to)))) (defcustom tab-bar-close-tab-select 'right @@ -466,85 +515,69 @@ If `right', select the adjacent right tab." :group 'tab-bar :version "27.1") -(defun tab-bar-close-current-tab (&optional tab select-tab) - "Close the current TAB. -After closing the current tab switch to the tab -specified by `tab-bar-close-tab-select', or to `select-tab' -if its value is provided." - (interactive) - (let ((tabs (tab-bar-tabs))) - (unless tab - (let ((prev-tab (tab-bar-find-prev-tab tabs))) - (setq tab (if prev-tab - (car (cdr prev-tab)) - (car tabs))))) - (if select-tab - (setq tabs (delq tab tabs)) - (let* ((i-tab (- (length tabs) (length (memq tab tabs)))) - (i-select - (cond - ((eq tab-bar-close-tab-select 'left) - (1- i-tab)) - ((eq tab-bar-close-tab-select 'right) - ;; Do nothing: the next tab will take - ;; the index of the closed tab - i-tab) - (t 0)))) - (setq tabs (delq tab tabs) - i-select (max 0 (min (1- (length tabs)) i-select)) - select-tab (nth i-select tabs)))) +(defun tab-bar-close-tab (&optional arg to-index) + "Close the tab specified by its absolute position ARG. +If no ARG is specified, then close the current tab and switch +to the tab specified by `tab-bar-close-tab-select'. +ARG counts from 1. +Optional TO-INDEX could be specified to override the value of +`tab-bar-close-tab-select' programmatically with a position +of an existing tab to select after closing the current tab. +TO-INDEX counts from 1." + (interactive "P") + (let* ((tabs (tab-bar-tabs)) + (current-index (tab-bar--current-tab-index tabs)) + (close-index (if (integerp arg) (1- arg) current-index))) + + ;; Select another tab before deleting the current tab + (when (eq current-index close-index) + (let ((to-index (or (if to-index (1- to-index)) + (pcase tab-bar-close-tab-select + ('left (1- current-index)) + ('right (if (> (length tabs) (1+ current-index)) + (1+ current-index) + (1- current-index))))))) + (setq to-index (max 0 (min (or to-index 0) (1- (length tabs))))) + (tab-bar-select-tab (1+ to-index)) + ;; Re-read tabs after selecting another tab + (setq tabs (tab-bar-tabs)))) + + (set-frame-parameter nil 'tabs (delq (nth close-index tabs) tabs)) + (when (and tab-bar-mode (and (natnump tab-bar-show) (<= (length tabs) tab-bar-show))) (tab-bar-mode -1)) - (set-frame-parameter nil 'tabs tabs) - (tab-bar-select-tab select-tab))) - -(defun tab-bar-close-tab (tab) - "Close the specified TAB. -After closing the current tab switch to the tab -specified by `tab-bar-close-tab-select'." - (interactive (list (tab-bar-read-tab-name "Close tab by name: "))) - (when tab - (if (eq (car tab) 'current-tab) - (tab-bar-close-current-tab tab) - (let ((tabs (tab-bar-tabs))) - ;; Close non-current tab, no need to switch to another tab - (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= (length tabs) tab-bar-show))) - (tab-bar-mode -1)) - (set-frame-parameter nil 'tabs (delq tab tabs)) - (when tab-bar-mode - (force-mode-line-update)))))) + (if tab-bar-mode + (force-mode-line-update) + (message "Deleted tab and switched to %s" tab-bar-close-tab-select)))) + +(defun tab-bar-close-tab-by-name (name) + "Close the tab by NAME." + (interactive (list (completing-read "Close tab by name: " + (mapcar (lambda (tab) + (cdr (assq 'name tab))) + (tab-bar-tabs))))) + (tab-bar-close-tab (1+ (tab-bar--tab-index-by-name name)))) -;;; Non-graphical access to frame-local tabs (named window configurations) - -(defun tab-new () - "Create a new named window configuration without having to click a tab." - (interactive) - (tab-bar-new-tab) - (unless tab-bar-mode - (message "Added new tab with the current window configuration"))) - -(defun tab-close () - "Delete the current window configuration without clicking a close button." - (interactive) - (tab-bar-close-current-tab) - (unless tab-bar-mode - (message "Deleted the current tab"))) +;;; Short aliases -;; Short aliases -;; (defalias 'tab-switch 'tab-bar-switch-to-next-tab) -(defalias 'tab-select 'tab-bar-select-tab) +(defalias 'tab-new 'tab-bar-new-tab) +(defalias 'tab-close 'tab-bar-close-tab) +(defalias 'tab-select 'tab-bar-select-tab) +(defalias 'tab-next 'tab-bar-switch-to-next-tab) (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) -(defalias 'tab-next 'tab-bar-switch-to-next-tab) -(defalias 'tab-list 'tab-bar-list) +(defalias 'tab-list 'tab-bar-list) + + +;;; Non-graphical access to frame-local tabs (named window configurations) (defun tab-bar-list () "Display a list of named window configurations. The list is displayed in the buffer `*Tabs*'. +It's placed in the center of the frame to resemble a window list +displayed by a window switcher in some window managers on Alt+Tab. In this list of window configurations you can delete or select them. Type ? after invocation to get help on commands available. @@ -555,7 +588,7 @@ marked for deletion." (interactive) (let ((dir default-directory) (minibuf (minibuffer-selected-window))) - (let ((tab-bar-mode t)) ; don't enable tab-bar-mode if it's disabled + (let ((tab-bar-show nil)) ; don't enable tab-bar-mode if it's disabled (tab-bar-new-tab)) ;; Handle the case when it's called in the active minibuffer. (when minibuf (select-window (minibuffer-selected-window))) @@ -660,7 +693,6 @@ Letters do not insert themselves; instead, they are commands. (user-error "No window configuration on this line") nil)))) - (defun tab-bar-list-next-line (&optional arg) (interactive) (forward-line arg) @@ -748,12 +780,10 @@ Then move up one line. Prefix arg means move that many lines." This command deletes and replaces all the previously existing windows in the selected frame." (interactive) - (let* ((select-tab (tab-bar-list-current-tab t))) + (let* ((to-tab (tab-bar-list-current-tab t))) (kill-buffer (current-buffer)) ;; Delete the current window configuration - (tab-bar-close-current-tab nil select-tab) - ;; (tab-bar-select-tab select-tab) - )) + (tab-bar-close-tab nil (1+ (tab-bar--tab-index to-tab))))) (defun tab-bar-list-mouse-select (event) "Select the window configuration whose line you click on." commit 080e8084e83f70f9add7b42d2f24b03db931fcf9 Author: Artyom Loenko Date: Sat Oct 5 17:49:23 2019 +0100 Include new permission settings for macOS 10.15 (bug#37551) * nextstep/templates/Info.plist.in (NSDesktopFolderUsageDescription): (NSDocumentsFolderUsageDescription): (NSDownloadsFolderUsageDescription): (NSRemovableVolumesUsageDescription): Add description to enable setting in macOS 10.15. Copyright-paperwork-exempt: yes diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in index c1e50a8409..652cedf056 100644 --- a/nextstep/templates/Info.plist.in +++ b/nextstep/templates/Info.plist.in @@ -677,5 +677,13 @@ along with GNU Emacs. If not, see . YES NSAppleEventsUsageDescription Emacs requires permission to send AppleEvents to other applications. + NSDesktopFolderUsageDescription + Emacs requires permission to access the Desktop folder. + NSDocumentsFolderUsageDescription + Emacs requires permission to access the Documents folder. + NSDownloadsFolderUsageDescription + Emacs requires permission to access the Downloads folder. + NSRemovableVolumesUsageDescription + Emacs requires permission to access files on Removable Volumes. commit e72e4990f99c5d56502d304f448a410bb17d12d7 Author: Paul Smith Date: Sat Oct 5 12:29:04 2019 -0700 Support GNU make error messages in compile mode. * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Match GNU make error messages. * test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data): Test GNU make error message matching. (compile-test-error-regexps): Update count of infos found. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 83efb3e029..50370a4f3a 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -274,6 +274,12 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (ruby-Test::Unit "^[\t ]*\\[\\([^(].*\\):\\([1-9][0-9]*\\)\\(\\]\\)?:in " 1 2) + (gmake + ;; Set GNU make error messages as INFO level. + ;; It starts with the name of the make program which is variable, + ;; so don't try to match it. + ": \\*\\*\\* \\[\\(\\(.+?\\):\\([0-9]+\\): .+\\)\\]" 2 3 nil 0 1) + (gnu ;; The first line matches the program name for diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index 8e59a5401b..08a369e7b5 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -180,6 +180,12 @@ 1 0 31 "/usr/include/c++/3.3/backward/iostream.h") (" from test_clt.cc:1:" 1 nil 1 "test_clt.cc") + ;; gmake + ("make: *** [Makefile:20: all] Error 2" 12 nil 20 "Makefile" 0) + ("make[4]: *** [sub/make.mk:19: all] Error 127" 15 nil 19 "sub/make.mk" 0) + ("gmake[4]: *** [sub/make.mk:19: all] Error 2" 16 nil 19 "sub/make.mk" 0) + ("gmake-4.3[4]: *** [make.mk:1119: all] Error 2" 20 nil 1119 "make.mk" 0) + ("Make-4.3: *** [make.INC:1119: dir/all] Error 2" 16 nil 1119 "make.INC" 0) ;; gnu ("foo.c:8: message" 1 nil 8 "foo.c") ("../foo.c:8: W: message" 1 nil 8 "../foo.c") @@ -409,7 +415,7 @@ The test data is in `compile-tests--test-regexps-data'." (mapc #'compile--test-error-line compile-tests--test-regexps-data) (should (eq compilation-num-errors-found 87)) (should (eq compilation-num-warnings-found 32)) - (should (eq compilation-num-infos-found 21))))) + (should (eq compilation-num-infos-found 26))))) (ert-deftest compile-test-grep-regexps () "Test the `grep-regexp-alist' regexps. commit 4f2de56830ea25d812b05c954abd0600a012f9ef Author: Lars Ingebrigtsen Date: Sat Oct 5 17:01:33 2019 +0200 Remove some XEmacs compat code from the CEDET tests diff --git a/test/manual/cedet/cedet-utests.el b/test/manual/cedet/cedet-utests.el index 67a828bb29..b8f08886fe 100644 --- a/test/manual/cedet/cedet-utests.el +++ b/test/manual/cedet/cedet-utests.el @@ -57,7 +57,7 @@ (require 'eieio-custom) (customize-variable 'eieio-widget-test))) ("eieio: chart" . (lambda () - (if (cedet-utest-noninteractive) + (if noninteractive (message " ** Skipping test in noninteractive mode.") (chart-test-it-all)))) ;; @@ -77,7 +77,7 @@ ("semanticdb: data cache" . semantic-test-data-cache) ("semantic: throw-on-input" . (lambda () - (if (cedet-utest-noninteractive) + (if noninteractive (message " ** Skipping test in noninteractive mode.") (semantic-test-throw-on-input)))) @@ -145,14 +145,13 @@ of just logging the error." (defun cedet-utest-noninteractive () "Return non-nil if running non-interactively." - (if (featurep 'xemacs) - (noninteractive) - noninteractive)) + (declare (obsolete nil "27.1")) + noninteractive) ;;;###autoload (defun cedet-utest-batch () "Run the CEDET unit test in BATCH mode." - (unless (cedet-utest-noninteractive) + (unless noninteractive (error "`cedet-utest-batch' is to be used only with -batch")) (condition-case err (when (catch 'cedet-utest-exit-on-error @@ -200,7 +199,7 @@ of just logging the error." "Setup a frame and buffer for unit testing. Optional argument TITLE is the title of this testing session." (setq cedet-utest-log-timer (current-time)) - (if (cedet-utest-noninteractive) + (if noninteractive (message "\n>> Setting up %s tests to run @ %s\n" (or title "") (current-time-string)) @@ -245,7 +244,7 @@ ERRORCONDITION is some error that may have occurred during testing." (defun cedet-utest-log-shutdown-msg (title startime endtime) "Show a shutdown message with TITLE, STARTIME, and ENDTIME." - (if (cedet-utest-noninteractive) + (if noninteractive (progn (message "\n>> Test Suite %s ended at @ %s" title @@ -266,7 +265,7 @@ ERRORCONDITION is some error that may have occurred during testing." (defun cedet-utest-show-log-end () "Show the end of the current unit test log." - (unless (cedet-utest-noninteractive) + (unless noninteractive (let* ((cb (current-buffer)) (cf (selected-frame)) (bw (or (get-buffer-window cedet-utest-buffer t) @@ -282,7 +281,7 @@ ERRORCONDITION is some error that may have occurred during testing." (defun cedet-utest-post-command-hook () "Hook run after the current log command was run." - (if (cedet-utest-noninteractive) + (if noninteractive (message "") (save-excursion (set-buffer cedet-utest-buffer) @@ -299,7 +298,7 @@ ERRORCONDITION is some error that may have occurred during testing." ;; This next line makes sure we clear out status during logging. (add-hook 'post-command-hook 'cedet-utest-post-command-hook) - (if (cedet-utest-noninteractive) + (if noninteractive (message " - Running %s ..." item) (save-excursion (set-buffer cedet-utest-buffer) @@ -316,7 +315,7 @@ ERRORCONDITION is some error that may have occurred during testing." Apply NOTES to the doneness of the log. Apply ERR if there was an error in previous item. Optional argument PRECR indicates to prefix the done msg w/ a newline." - (if (cedet-utest-noninteractive) + (if noninteractive ;; Non-interactive-mode - show a message. (if notes (message " * %s {%s}" (or err "done") notes) @@ -356,7 +355,7 @@ Optional argument PRECR indicates to prefix the done msg w/ a newline." (defun cedet-utest-log(format &rest args) "Log the text string FORMAT. The rest of the ARGS are used to fill in FORMAT with `format'." - (if (cedet-utest-noninteractive) + (if noninteractive (apply 'message format args) (save-excursion (set-buffer cedet-utest-buffer) diff --git a/test/manual/cedet/srecode-tests.el b/test/manual/cedet/srecode-tests.el index 63d10973e5..94c5dbbd95 100644 --- a/test/manual/cedet/srecode-tests.el +++ b/test/manual/cedet/srecode-tests.el @@ -39,9 +39,7 @@ It is filled with some text." (defun srecode-field-utest () "Test the srecode field manager." (interactive) - (if (featurep 'xemacs) - (message "There is no XEmacs support for SRecode Fields.") - (srecode-field-utest-impl))) + (srecode-field-utest-impl)) (defun srecode-field-utest-impl () "Implementation of the SRecode field utest." commit 9f6a59849f69efd1d8026b040b9e9a397df03499 Author: Lars Ingebrigtsen Date: Sat Oct 5 16:59:13 2019 +0200 Remove some XEmacs compat code from esh*.el * lisp/eshell/esh-util.el: Remove some XEmacs compat functions. diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 83cc5999dc..9bd5de8983 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el @@ -101,8 +101,7 @@ ;;; Code: (require 'esh-util) -(unless (featurep 'xemacs) - (require 'eldoc)) +(require 'eldoc) (require 'esh-arg) (require 'esh-proc) (require 'esh-module) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 91204877f5..5cdbf754cd 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -267,19 +267,13 @@ This is used by `eshell-watch-for-password-prompt'." (modify-syntax-entry ?\] ")[ " st) ;; All non-word multibyte characters should be `symbol'. (map-char-table - (if (featurep 'xemacs) - (lambda (key _val) - (and (characterp key) - (>= (char-int key) 256) - (/= (char-syntax key) ?w) - (modify-syntax-entry key "_ " st))) - (lambda (key _val) - (and (if (consp key) - (and (>= (car key) 128) - (/= (char-syntax (car key)) ?w)) - (and (>= key 256) - (/= (char-syntax key) ?w))) - (modify-syntax-entry key "_ " st)))) + (lambda (key _val) + (and (if (consp key) + (and (>= (car key) 128) + (/= (char-syntax (car key)) ?w)) + (and (>= key 256) + (/= (char-syntax key) ?w))) + (modify-syntax-entry key "_ " st))) (standard-syntax-table)) st)) diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 353b9400f2..bab42423c6 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -511,19 +511,6 @@ list." (eshell-read-hosts eshell-hosts-file 'eshell-host-names 'eshell-host-timestamp))) -(and (featurep 'xemacs) - (not (fboundp 'subst-char-in-string)) - (defun subst-char-in-string (fromchar tochar string &optional inplace) - "Replace FROMCHAR with TOCHAR in STRING each time it occurs. -Unless optional argument INPLACE is non-nil, return a new string." - (let ((i (length string)) - (newstr (if inplace string (copy-sequence string)))) - (while (> i 0) - (setq i (1- i)) - (if (eq (aref newstr i) fromchar) - (aset newstr i tochar))) - newstr))) - (defsubst eshell-copy-environment () "Return an unrelated copy of `process-environment'." (mapcar 'concat process-environment)) @@ -559,27 +546,6 @@ Unless optional argument INPLACE is non-nil, return a new string." (substring string 0 sublen) string))) -(defvar ange-cache) - -;; Partial reimplementation of Emacs's builtin directory-files-and-attributes. -;; id-format not implemented. -(and (featurep 'xemacs) - (not (fboundp 'directory-files-and-attributes)) - (defun directory-files-and-attributes (directory &optional full match nosort _id-format) - "Return a list of names of files and their attributes in DIRECTORY. -There are three optional arguments: -If FULL is non-nil, return absolute file names. Otherwise return names - that are relative to the specified directory. -If MATCH is non-nil, mention only file names that match the regexp MATCH. -If NOSORT is non-nil, the list is not sorted--its order is unpredictable. - NOSORT is useful if you plan to sort the result yourself." - (let ((directory (expand-file-name directory)) ange-cache) - (mapcar - (function - (lambda (file) - (cons file (eshell-file-attributes (expand-file-name file directory))))) - (directory-files directory full match nosort))))) - (defun eshell-directory-files-and-attributes (dir &optional full match nosort id-format) "Make sure to use the handler for `directory-file-and-attributes'." (let* ((dir (expand-file-name dir))) commit 33dc41043820c3c28e65ffe0010c047d3b9b0e78 Author: Lars Ingebrigtsen Date: Sat Oct 5 16:54:57 2019 +0200 Remove more XEmacs compat code from ezimage.el * lisp/ezimage.el (ezimage-use-images) (ezimage-insert-over-text): Remove XEmacs compat code. diff --git a/lisp/ezimage.el b/lisp/ezimage.el index 6c590f16ac..f2b62b27fa 100644 --- a/lisp/ezimage.el +++ b/lisp/ezimage.el @@ -37,11 +37,8 @@ (error nil)) ;;; Code: -(defcustom ezimage-use-images (if (featurep 'xemacs) - (and (fboundp 'make-image-specifier) - window-system) - (and (display-images-p) - (image-type-available-p 'xpm))) +(defcustom ezimage-use-images (and (display-images-p) + (image-type-available-p 'xpm)) "Non-nil means ezimage should display icons." :group 'ezimage :version "21.1" @@ -216,13 +213,8 @@ Assumes the image is part of a GUI and can be clicked on. Optional argument STRING is a string upon which to add text properties." (when ezimage-use-images (add-text-properties start end - (if (featurep 'xemacs) - (list 'end-glyph image - 'rear-nonsticky (list 'display) - 'invisible t - 'detachable t) - (list 'display image - 'rear-nonsticky (list 'display))) + (list 'display image + 'rear-nonsticky (list 'display)) string)) string) commit 73c6192fe67a8a6cc43d3bce232d8543a09999e4 Author: Lars Ingebrigtsen Date: Sat Oct 5 16:50:16 2019 +0200 Fix typo in frames.texi xref * doc/emacs/frames.texi (Tab Bars): Fix typo in xref. diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 2acc65c189..43cdb2664d 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1234,7 +1234,7 @@ configuration of windows and buffers which was previously used in the frame when that tab was the current tab. If you are using the desktop library to save and restore your -sessions (@pxref{Saving Emacs Sesions}), the tabs from the Tab Bar are +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. commit 3c1635ebf2038d43c3400908e7e070d54192801a Author: Lars Ingebrigtsen Date: Sat Oct 5 16:48:44 2019 +0200 Remove most of the XEmacs compat code from ediff*.el * lisp/vc/ediff-diff.el (ediff-word-1): Remove XEmacs compat code and declare compatibility functions for obsolete. Adjust all callers. * lisp/vc/ediff-help.el (ediff-set-help-overlays): * lisp/vc/ediff-hook.el: (menu-bar-ediff-misc-menu, menu-bar-ediff-merge-menu) (menu-bar-ediff-menu, menu-bar-ediff-merge-menu) (menu-bar-epatch-menu, menu-bar-ediff-misc-menu): * lisp/vc/ediff-init.el (ediff-device-type) (ediff-window-display-p, ediff-has-face-support-p) (ediff-has-toolbar-support-p, ediff-has-gutter-support-p) (ediff-BAD-INFO, ediff-coding-system-for-write) (ediff-read-event, ediff-overlayp, ediff-make-overlay) (ediff-delete-overlay, ediff-color-display-p) (ediff-display-pixel-width, ediff-display-pixel-height) (ediff-region-help-echo, ediff-set-face-pixmap) (ediff-paint-background-regions-in-one-buffer) (ediff-clear-fine-diff-vector, ediff-mouse-event-p) (ediff-key-press-event-p, ediff-event-point, ) (ediff-event-buffer, ediff-event-key, ediff-last-command-char) (ediff-frame-iconified-p, ediff-frame-char-width) (ediff-reset-mouse, ediff-frame-char-height) (ediff-overlay-start, ediff-overlay-end, ediff-overlay-buffer) (ediff-overlay-get, ediff-move-overlay, ediff-overlay-put) (ediff-abbreviate-file-name): * lisp/vc/ediff-mult.el (ediff-next-meta-item) (ediff-previous-meta-item) (ediff-replace-session-activity-marker-in-meta-buffer) (ediff-replace-session-status-in-meta-buffer) (ediff-redraw-directory-group-buffer) (ediff-update-markers-in-dir-meta-buffer) (ediff-update-session-marker-in-dir-meta-buffer) (ediff-redraw-registry-buffer, ediff-set-meta-overlay) (ediff-update-meta-buffer, ediff-get-meta-info) (ediff-get-meta-overlay-at-pos, ) (ediff-get-session-number-at-pos, ) (ediff-next-meta-overlay-start) (ediff-previous-meta-overlay-start, ) (ediff-meta-mark-equal-files): * lisp/vc/ediff-util.el: (ediff-setup, ediff-setup-control-buffer, ediff-recenter) (ediff-recenter-one-window, ediff-toggle-read-only) (ediff-file-checked-out-p, ediff-file-checked-in-p) (ediff-toggle-wide-display, ediff-toggle-multiframe) (ediff-toggle-use-toolbar, ediff-kill-bottom-toolbar) (ediff-visible-region, ediff-scroll-vertically) (ediff-scroll-horizontally, ediff-jump-to-difference-at-point) (ediff-diff-to-diff, ediff-restore-diff) (ediff-toggle-regexp-match, ediff-really-quit) (ediff-cleanup-mess, ediff-highlight-diff-in-one-buffer) (ediff-unhighlight-diffs-totally-in-one-buffer) (ediff-save-buffer, ediff-make-cloned-buffer) (ediff-make-indirect-buffer, ediff-remove-flags-from-buffer) (ediff-place-flags-in-buffer1, ediff-get-diff-posn) (ediff-clear-diff-vector, ediff-make-bullet-proof-overlay) (ediff-submit-report, ediff-deactivate-mark) (ediff-activate-mark, ediff-profile, ediff-print-diff-vector): * lisp/vc/ediff-wind.el (ediff-control-frame-parameters) (ediff-get-window-by-clicking, ediff-select-lowest-window) (ediff-setup-windows-plain-merge) (ediff-setup-windows-plain-compare, ediff-setup-control-frame) (ediff-destroy-control-frame, ediff-make-frame-position) (ediff-make-wide-display, ediff-get-visible-buffer-window): * lisp/vc/ediff.el (ediff-version, ediff-documentation): diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index 0c8c89610f..dded160c57 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -1231,8 +1231,7 @@ Used for splitting difference regions into individual words.") These characters are ignored when differing regions are split into words.") (make-variable-buffer-local 'ediff-whitespace) -(defvar ediff-word-1 - (if (featurep 'xemacs) "a-zA-Z---_" "-[:word:]_") +(defvar ediff-word-1 "-[:word:]_" "Characters that constitute words of type 1. More precisely, [ediff-word-1] is a regexp that matches type 1 words. See `ediff-forward-word' for more details.") diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index 0b12756474..f291d40bc2 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el @@ -166,7 +166,7 @@ the value of this variable and the variables `ediff-help-message-*' in (setq beg (match-beginning 1) end (match-end 0) cmd (buffer-substring (match-beginning 1) (match-end 1))) - (setq overl (ediff-make-overlay beg end)) + (setq overl (make-overlay beg end)) (ediff-overlay-put overl 'mouse-face 'highlight) (ediff-overlay-put overl 'ediff-help-info cmd)))) diff --git a/lisp/vc/ediff-hook.el b/lisp/vc/ediff-hook.el index 7a04249fc8..2aa03cc930 100644 --- a/lisp/vc/ediff-hook.el +++ b/lisp/vc/ediff-hook.el @@ -44,222 +44,141 @@ ;; allow menus to be set up without ediff-wind.el being loaded -;; This autoload is useless in Emacs because ediff-hook.el is dumped with -;; emacs, but it is needed in XEmacs -;;;###autoload -(if (featurep 'xemacs) - (progn - (defun ediff-xemacs-init-menus () - (when (featurep 'menubar) - (add-submenu - '("Tools") ediff-menu "OO-Browser...") - (add-submenu - '("Tools") ediff-merge-menu "OO-Browser...") - (add-submenu - '("Tools") epatch-menu "OO-Browser...") - (add-submenu - '("Tools") ediff-misc-menu "OO-Browser...") - (add-menu-button - '("Tools") "-------" "OO-Browser...") - )) - (defvar ediff-menu - '("Compare" - ["Two Files..." ediff-files t] - ["Two Buffers..." ediff-buffers t] - ["Three Files..." ediff-files3 t] - ["Three Buffers..." ediff-buffers3 t] - "---" - ["Two Directories..." ediff-directories t] - ["Three Directories..." ediff-directories3 t] - "---" - ["File with Revision..." ediff-revision t] - ["Directory Revisions..." ediff-directory-revisions t] - "---" - ["Windows Word-by-word..." ediff-windows-wordwise t] - ["Windows Line-by-line..." ediff-windows-linewise t] - "---" - ["Regions Word-by-word..." ediff-regions-wordwise t] - ["Regions Line-by-line..." ediff-regions-linewise t] - )) - (defvar ediff-merge-menu - '("Merge" - ["Files..." ediff-merge-files t] - ["Files with Ancestor..." ediff-merge-files-with-ancestor t] - ["Buffers..." ediff-merge-buffers t] - ["Buffers with Ancestor..." - ediff-merge-buffers-with-ancestor t] - "---" - ["Directories..." ediff-merge-directories t] - ["Directories with Ancestor..." - ediff-merge-directories-with-ancestor t] - "---" - ["Revisions..." ediff-merge-revisions t] - ["Revisions with Ancestor..." - ediff-merge-revisions-with-ancestor t] - ["Directory Revisions..." ediff-merge-directory-revisions t] - ["Directory Revisions with Ancestor..." - ediff-merge-directory-revisions-with-ancestor t] - )) - (defvar epatch-menu - '("Apply Patch" - ["To a file..." ediff-patch-file t] - ["To a buffer..." ediff-patch-buffer t] - )) - (defvar ediff-misc-menu - '("Ediff Miscellanea" - ["Ediff Manual" ediff-documentation t] - ["Customize Ediff" ediff-customize t] - ["List Ediff Sessions" ediff-show-registry t] - ["Use separate frame for Ediff control buffer" - ediff-toggle-multiframe - :style toggle - :selected (eq (bound-and-true-p ediff-window-setup-function) - #'ediff-setup-windows-multiframe)] - ["Use a toolbar with Ediff control buffer" - ediff-toggle-use-toolbar - :style toggle - :selected (if (featurep 'ediff-tbar) - (ediff-use-toolbar-p))])) - - ;; put these menus before Object-Oriented-Browser in Tools menu - (if (and (featurep 'menubar) (not (featurep 'infodock)) - (not (featurep 'ediff-hook))) - (ediff-xemacs-init-menus))) - ;; Emacs - ;; initialize menu bar keymaps - (defvar menu-bar-ediff-misc-menu - (make-sparse-keymap "Ediff Miscellanea")) - (fset 'menu-bar-ediff-misc-menu - menu-bar-ediff-misc-menu) - (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) - (fset 'menu-bar-epatch-menu menu-bar-epatch-menu) - (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) - (fset 'menu-bar-ediff-merge-menu - menu-bar-ediff-merge-menu) - (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) - (fset 'menu-bar-ediff-menu menu-bar-ediff-menu) - - ;; define ediff compare menu - (define-key menu-bar-ediff-menu [ediff-misc] - `(menu-item ,(purecopy "Ediff Miscellanea") menu-bar-ediff-misc-menu)) - (define-key menu-bar-ediff-menu [separator-ediff-misc] menu-bar-separator) - (define-key menu-bar-ediff-menu [window] - `(menu-item ,(purecopy "This Window and Next Window") compare-windows - :help ,(purecopy "Compare the current window and the next window"))) - (define-key menu-bar-ediff-menu [ediff-windows-linewise] - `(menu-item ,(purecopy "Windows Line-by-line...") ediff-windows-linewise - :help ,(purecopy "Compare windows line-wise"))) - (define-key menu-bar-ediff-menu [ediff-windows-wordwise] - `(menu-item ,(purecopy "Windows Word-by-word...") ediff-windows-wordwise - :help ,(purecopy "Compare windows word-wise"))) - (define-key menu-bar-ediff-menu [separator-ediff-windows] menu-bar-separator) - (define-key menu-bar-ediff-menu [ediff-regions-linewise] - `(menu-item ,(purecopy "Regions Line-by-line...") ediff-regions-linewise - :help ,(purecopy "Compare regions line-wise"))) - (define-key menu-bar-ediff-menu [ediff-regions-wordwise] - `(menu-item ,(purecopy "Regions Word-by-word...") ediff-regions-wordwise - :help ,(purecopy "Compare regions word-wise"))) - (define-key menu-bar-ediff-menu [separator-ediff-regions] menu-bar-separator) - (define-key menu-bar-ediff-menu [ediff-dir-revision] - `(menu-item ,(purecopy "Directory Revisions...") ediff-directory-revisions - :help ,(purecopy "Compare directory files with their older versions"))) - (define-key menu-bar-ediff-menu [ediff-revision] - `(menu-item ,(purecopy "File with Revision...") ediff-revision - :help ,(purecopy "Compare file with its older versions"))) - (define-key menu-bar-ediff-menu [separator-ediff-directories] menu-bar-separator) - (define-key menu-bar-ediff-menu [ediff-directories3] - `(menu-item ,(purecopy "Three Directories...") ediff-directories3 - :help ,(purecopy "Compare files common to three directories simultaneously"))) - (define-key menu-bar-ediff-menu [ediff-directories] - `(menu-item ,(purecopy "Two Directories...") ediff-directories - :help ,(purecopy "Compare files common to two directories simultaneously"))) - (define-key menu-bar-ediff-menu [separator-ediff-files] menu-bar-separator) - (define-key menu-bar-ediff-menu [ediff-buffers3] - `(menu-item ,(purecopy "Three Buffers...") ediff-buffers3 - :help ,(purecopy "Compare three buffers simultaneously"))) - (define-key menu-bar-ediff-menu [ediff-files3] - `(menu-item ,(purecopy "Three Files...") ediff-files3 - :help ,(purecopy "Compare three files simultaneously"))) - (define-key menu-bar-ediff-menu [ediff-buffers] - `(menu-item ,(purecopy "Two Buffers...") ediff-buffers - :help ,(purecopy "Compare two buffers simultaneously"))) - (define-key menu-bar-ediff-menu [ediff-files] - `(menu-item ,(purecopy "Two Files...") ediff-files - :help ,(purecopy "Compare two files simultaneously"))) - - ;; define ediff merge menu - (define-key - menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor] - `(menu-item ,(purecopy "Directory Revisions with Ancestor...") - ediff-merge-directory-revisions-with-ancestor - :help ,(purecopy "Merge versions of the files in the same directory by comparing the files with common ancestors"))) - (define-key - menu-bar-ediff-merge-menu [ediff-merge-dir-revisions] - `(menu-item ,(purecopy "Directory Revisions...") ediff-merge-directory-revisions - :help ,(purecopy "Merge versions of the files in the same directory (without using ancestor information)"))) - (define-key - menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor] - `(menu-item ,(purecopy "Revisions with Ancestor...") - ediff-merge-revisions-with-ancestor - :help ,(purecopy "Merge versions of the same file by comparing them with a common ancestor"))) - (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions] - `(menu-item ,(purecopy "Revisions...") ediff-merge-revisions - :help ,(purecopy "Merge versions of the same file (without using ancestor information)"))) - (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] menu-bar-separator) - (define-key - menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor] - `(menu-item ,(purecopy "Directories with Ancestor...") - ediff-merge-directories-with-ancestor - :help ,(purecopy "Merge files common to a pair of directories by comparing the files with common ancestors"))) - (define-key menu-bar-ediff-merge-menu [ediff-merge-directories] - `(menu-item ,(purecopy "Directories...") ediff-merge-directories - :help ,(purecopy "Merge files common to a pair of directories"))) - (define-key - menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] menu-bar-separator) - (define-key - menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor] - `(menu-item ,(purecopy "Buffers with Ancestor...") ediff-merge-buffers-with-ancestor - :help ,(purecopy "Merge buffers by comparing their contents with a common ancestor"))) - (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers] - `(menu-item ,(purecopy "Buffers...") ediff-merge-buffers - :help ,(purecopy "Merge buffers (without using ancestor information)"))) - (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor] - `(menu-item ,(purecopy "Files with Ancestor...") ediff-merge-files-with-ancestor - :help ,(purecopy "Merge files by comparing them with a common ancestor"))) - (define-key menu-bar-ediff-merge-menu [ediff-merge-files] - `(menu-item ,(purecopy "Files...") ediff-merge-files - :help ,(purecopy "Merge files (without using ancestor information)"))) - - ;; define epatch menu - (define-key menu-bar-epatch-menu [ediff-patch-buffer] - `(menu-item ,(purecopy "To a Buffer...") ediff-patch-buffer - :help ,(purecopy "Apply a patch to the contents of a buffer"))) - (define-key menu-bar-epatch-menu [ediff-patch-file] - `(menu-item ,(purecopy "To a File...") ediff-patch-file - :help ,(purecopy "Apply a patch to a file"))) - - ;; define ediff miscellanea - (define-key menu-bar-ediff-misc-menu [emultiframe] - `(menu-item ,(purecopy "Use separate control buffer frame") - ediff-toggle-multiframe - :help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode") - :button (:toggle . (eq (bound-and-true-p ediff-window-setup-function) - #'ediff-setup-windows-multiframe)))) - ;; FIXME: Port XEmacs's toolbar support! - ;; ["Use a toolbar with Ediff control buffer" - ;; ediff-toggle-use-toolbar - ;; :style toggle - ;; :selected (if (featurep 'ediff-tbar) - ;; (ediff-use-toolbar-p))] - (define-key menu-bar-ediff-misc-menu [eregistry] - `(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry - :help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session"))) - (define-key menu-bar-ediff-misc-menu [ediff-cust] - `(menu-item ,(purecopy "Customize Ediff") ediff-customize - :help ,(purecopy "Change some of the parameters that govern the behavior of Ediff"))) - (define-key menu-bar-ediff-misc-menu [ediff-doc] - `(menu-item ,(purecopy "Ediff Manual") ediff-documentation - :help ,(purecopy "Bring up the Ediff manual")))) +;; Emacs +;; initialize menu bar keymaps +(defvar menu-bar-ediff-misc-menu + (make-sparse-keymap "Ediff Miscellanea")) +(fset 'menu-bar-ediff-misc-menu + menu-bar-ediff-misc-menu) +(defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) +(fset 'menu-bar-epatch-menu menu-bar-epatch-menu) +(defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) +(fset 'menu-bar-ediff-merge-menu + menu-bar-ediff-merge-menu) +(defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) +(fset 'menu-bar-ediff-menu menu-bar-ediff-menu) + +;; define ediff compare menu +(define-key menu-bar-ediff-menu [ediff-misc] + `(menu-item ,(purecopy "Ediff Miscellanea") menu-bar-ediff-misc-menu)) +(define-key menu-bar-ediff-menu [separator-ediff-misc] menu-bar-separator) +(define-key menu-bar-ediff-menu [window] + `(menu-item ,(purecopy "This Window and Next Window") compare-windows + :help ,(purecopy "Compare the current window and the next window"))) +(define-key menu-bar-ediff-menu [ediff-windows-linewise] + `(menu-item ,(purecopy "Windows Line-by-line...") ediff-windows-linewise + :help ,(purecopy "Compare windows line-wise"))) +(define-key menu-bar-ediff-menu [ediff-windows-wordwise] + `(menu-item ,(purecopy "Windows Word-by-word...") ediff-windows-wordwise + :help ,(purecopy "Compare windows word-wise"))) +(define-key menu-bar-ediff-menu [separator-ediff-windows] menu-bar-separator) +(define-key menu-bar-ediff-menu [ediff-regions-linewise] + `(menu-item ,(purecopy "Regions Line-by-line...") ediff-regions-linewise + :help ,(purecopy "Compare regions line-wise"))) +(define-key menu-bar-ediff-menu [ediff-regions-wordwise] + `(menu-item ,(purecopy "Regions Word-by-word...") ediff-regions-wordwise + :help ,(purecopy "Compare regions word-wise"))) +(define-key menu-bar-ediff-menu [separator-ediff-regions] menu-bar-separator) +(define-key menu-bar-ediff-menu [ediff-dir-revision] + `(menu-item ,(purecopy "Directory Revisions...") ediff-directory-revisions + :help ,(purecopy "Compare directory files with their older versions"))) +(define-key menu-bar-ediff-menu [ediff-revision] + `(menu-item ,(purecopy "File with Revision...") ediff-revision + :help ,(purecopy "Compare file with its older versions"))) +(define-key menu-bar-ediff-menu [separator-ediff-directories] menu-bar-separator) +(define-key menu-bar-ediff-menu [ediff-directories3] + `(menu-item ,(purecopy "Three Directories...") ediff-directories3 + :help ,(purecopy "Compare files common to three directories simultaneously"))) +(define-key menu-bar-ediff-menu [ediff-directories] + `(menu-item ,(purecopy "Two Directories...") ediff-directories + :help ,(purecopy "Compare files common to two directories simultaneously"))) +(define-key menu-bar-ediff-menu [separator-ediff-files] menu-bar-separator) +(define-key menu-bar-ediff-menu [ediff-buffers3] + `(menu-item ,(purecopy "Three Buffers...") ediff-buffers3 + :help ,(purecopy "Compare three buffers simultaneously"))) +(define-key menu-bar-ediff-menu [ediff-files3] + `(menu-item ,(purecopy "Three Files...") ediff-files3 + :help ,(purecopy "Compare three files simultaneously"))) +(define-key menu-bar-ediff-menu [ediff-buffers] + `(menu-item ,(purecopy "Two Buffers...") ediff-buffers + :help ,(purecopy "Compare two buffers simultaneously"))) +(define-key menu-bar-ediff-menu [ediff-files] + `(menu-item ,(purecopy "Two Files...") ediff-files + :help ,(purecopy "Compare two files simultaneously"))) + +;; define ediff merge menu +(define-key + menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor] + `(menu-item ,(purecopy "Directory Revisions with Ancestor...") + ediff-merge-directory-revisions-with-ancestor + :help ,(purecopy "Merge versions of the files in the same directory by comparing the files with common ancestors"))) +(define-key + menu-bar-ediff-merge-menu [ediff-merge-dir-revisions] + `(menu-item ,(purecopy "Directory Revisions...") ediff-merge-directory-revisions + :help ,(purecopy "Merge versions of the files in the same directory (without using ancestor information)"))) +(define-key + menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor] + `(menu-item ,(purecopy "Revisions with Ancestor...") + ediff-merge-revisions-with-ancestor + :help ,(purecopy "Merge versions of the same file by comparing them with a common ancestor"))) +(define-key menu-bar-ediff-merge-menu [ediff-merge-revisions] + `(menu-item ,(purecopy "Revisions...") ediff-merge-revisions + :help ,(purecopy "Merge versions of the same file (without using ancestor information)"))) +(define-key menu-bar-ediff-merge-menu [separator-ediff-merge] menu-bar-separator) +(define-key + menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor] + `(menu-item ,(purecopy "Directories with Ancestor...") + ediff-merge-directories-with-ancestor + :help ,(purecopy "Merge files common to a pair of directories by comparing the files with common ancestors"))) +(define-key menu-bar-ediff-merge-menu [ediff-merge-directories] + `(menu-item ,(purecopy "Directories...") ediff-merge-directories + :help ,(purecopy "Merge files common to a pair of directories"))) +(define-key + menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] menu-bar-separator) +(define-key + menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor] + `(menu-item ,(purecopy "Buffers with Ancestor...") ediff-merge-buffers-with-ancestor + :help ,(purecopy "Merge buffers by comparing their contents with a common ancestor"))) +(define-key menu-bar-ediff-merge-menu [ediff-merge-buffers] + `(menu-item ,(purecopy "Buffers...") ediff-merge-buffers + :help ,(purecopy "Merge buffers (without using ancestor information)"))) +(define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor] + `(menu-item ,(purecopy "Files with Ancestor...") ediff-merge-files-with-ancestor + :help ,(purecopy "Merge files by comparing them with a common ancestor"))) +(define-key menu-bar-ediff-merge-menu [ediff-merge-files] + `(menu-item ,(purecopy "Files...") ediff-merge-files + :help ,(purecopy "Merge files (without using ancestor information)"))) + +;; define epatch menu +(define-key menu-bar-epatch-menu [ediff-patch-buffer] + `(menu-item ,(purecopy "To a Buffer...") ediff-patch-buffer + :help ,(purecopy "Apply a patch to the contents of a buffer"))) +(define-key menu-bar-epatch-menu [ediff-patch-file] + `(menu-item ,(purecopy "To a File...") ediff-patch-file + :help ,(purecopy "Apply a patch to a file"))) + +;; define ediff miscellanea +(define-key menu-bar-ediff-misc-menu [emultiframe] + `(menu-item ,(purecopy "Use separate control buffer frame") + ediff-toggle-multiframe + :help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode") + :button (:toggle . (eq (bound-and-true-p ediff-window-setup-function) + #'ediff-setup-windows-multiframe)))) +;; FIXME: Port XEmacs's toolbar support! +;; ["Use a toolbar with Ediff control buffer" +;; ediff-toggle-use-toolbar +;; :style toggle +;; :selected (if (featurep 'ediff-tbar) +;; (ediff-use-toolbar-p))] +(define-key menu-bar-ediff-misc-menu [eregistry] + `(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry + :help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session"))) +(define-key menu-bar-ediff-misc-menu [ediff-cust] + `(menu-item ,(purecopy "Customize Ediff") ediff-customize + :help ,(purecopy "Change some of the parameters that govern the behavior of Ediff"))) +(define-key menu-bar-ediff-misc-menu [ediff-doc] + `(menu-item ,(purecopy "Ediff Manual") ediff-documentation + :help ,(purecopy "Bring up the Ediff manual"))) (provide 'ediff-hook) ;;; ediff-hook.el ends here diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index c007d93448..9e4d08d70c 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -45,30 +45,29 @@ that Ediff doesn't know about.") ;; Are we running as a window application or on a TTY? (defsubst ediff-device-type () - (if (featurep 'xemacs) - (device-type (selected-device)) - window-system)) + (declare (obsolete nil "27.1")) + window-system) ;; in XEmacs: device-type is tty on tty and stream in batch. (defun ediff-window-display-p () - (and (ediff-device-type) (not (memq (ediff-device-type) '(tty pc stream))))) + (and window-system + (not (memq window-system '(tty pc stream))))) ;; test if supports faces (defun ediff-has-face-support-p () (cond ((ediff-window-display-p)) (ediff-force-faces) - ((ediff-color-display-p)) - (t (memq (ediff-device-type) '(pc))))) + ((display-color-p)) + (t (memq window-system '(pc))))) ;; toolbar support for emacs hasn't been implemented in ediff (defun ediff-has-toolbar-support-p () - (if (featurep 'xemacs) - (if (featurep 'toolbar) (console-on-window-system-p)))) + nil) (defun ediff-has-gutter-support-p () - (if (featurep 'xemacs) - (if (featurep 'gutter) (console-on-window-system-p)))) + (declare (obsolete nil "27.1")) + nil) (defun ediff-use-toolbar-p () (and (ediff-has-toolbar-support-p) ;Can it do it ? @@ -493,10 +492,9 @@ set local variables that determine how the display looks like." "%S: Bad diff region number, %d. Valid numbers are 1 to %d") (defconst ediff-BAD-INFO (format " *** The Info file for Ediff, a part of the standard distribution -*** of %sEmacs, does not seem to be properly installed. +*** of Emacs, does not seem to be properly installed. *** -*** Please contact your system administrator. " - (if (featurep 'xemacs) "X" ""))) +*** Please contact your system administrator. ")) ;; Selective browsing @@ -553,24 +551,24 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.") ;; Highlighting -(defcustom ediff-before-flag-bol (if (featurep 'xemacs) (make-glyph "->>") "->>") +(defcustom ediff-before-flag-bol "->>" "Flag placed before a highlighted block of differences, if block starts at beginning of a line." :type 'string :tag "Region before-flag at beginning of line" :group 'ediff) -(defcustom ediff-after-flag-eol (if (featurep 'xemacs) (make-glyph "<<-") "<<-") +(defcustom ediff-after-flag-eol "<<-" "Flag placed after a highlighted block of differences, if block ends at end of a line." :type 'string :tag "Region after-flag at end of line" :group 'ediff) -(defcustom ediff-before-flag-mol (if (featurep 'xemacs) (make-glyph "->>") "->>") +(defcustom ediff-before-flag-mol "->>" "Flag placed before a highlighted block of differences, if block starts in mid-line." :type 'string :tag "Region before-flag in the middle of line" :group 'ediff) -(defcustom ediff-after-flag-mol (if (featurep 'xemacs) (make-glyph "<<-") "<<-") +(defcustom ediff-after-flag-mol "<<-" "Flag placed after a highlighted block of differences, if block ends in mid-line." :type 'string :tag "Region after-flag in the middle of line" @@ -717,33 +715,22 @@ work." :type 'symbol :group 'ediff) -(defcustom ediff-coding-system-for-write (if (featurep 'xemacs) - 'escape-quoted - 'emacs-internal) +(defcustom ediff-coding-system-for-write 'emacs-internal "The coding system for write to use when writing out difference regions to temp files in buffer jobs and when Ediff needs to find fine differences." :type 'symbol :group 'ediff) -(defalias 'ediff-read-event - (if (featurep 'xemacs) 'next-command-event 'read-event)) +(define-obsolete-function-alias 'ediff-read-event #'read-event "27.1") -(defalias 'ediff-overlayp - (if (featurep 'xemacs) 'extentp 'overlayp)) +(define-obsolete-function-alias 'ediff-overlayp #'overlayp "27.1") -(defalias 'ediff-make-overlay - (if (featurep 'xemacs) 'make-extent 'make-overlay)) +(define-obsolete-function-alias 'ediff-make-overlay #'make-overlay "27.1") -(defalias 'ediff-delete-overlay - (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) +(define-obsolete-function-alias 'ediff-delete-overlay #'delete-overlay "27.1") -(defun ediff-color-display-p () - (condition-case nil - (if (featurep 'xemacs) - (eq (device-class (selected-device)) 'color) ; xemacs form - (display-color-p)) ; emacs form - (error nil))) +(define-obsolete-function-alias 'ediff-color-display-p #'display-color-p "27.1") ;; A var local to each control panel buffer. Indicates highlighting style @@ -754,12 +741,10 @@ to temp files in buffer jobs and when Ediff needs to find fine differences." "") -(if (featurep 'xemacs) - (progn - (defalias 'ediff-display-pixel-width 'device-pixel-width) - (defalias 'ediff-display-pixel-height 'device-pixel-height)) - (defalias 'ediff-display-pixel-width 'display-pixel-width) - (defalias 'ediff-display-pixel-height 'display-pixel-height)) +(define-obsolete-function-alias 'ediff-display-pixel-width + #'display-pixel-width "27.1") +(define-obsolete-function-alias 'ediff-display-pixel-height + #'display-pixel-height "27.1") ;; A-list of current-diff-overlay symbols associated with buf types (defconst ediff-current-diff-overlay-alist @@ -783,9 +768,9 @@ to temp files in buffer jobs and when Ediff needs to find fine differences." (defun ediff-region-help-echo (extent-or-window &optional overlay _point) (unless overlay (setq overlay extent-or-window)) - (let ((is-current (ediff-overlay-get overlay 'ediff)) - (face (ediff-overlay-get overlay 'face)) - (diff-num (ediff-overlay-get overlay 'ediff-diff-num)) + (let ((is-current (overlay-get overlay 'ediff)) + (face (overlay-get overlay 'face)) + (diff-num (overlay-get overlay 'ediff-diff-num)) face-help) ;; This happens only for refinement overlays @@ -804,7 +789,7 @@ to temp files in buffer jobs and when Ediff needs to find fine differences." (defun ediff-set-face-pixmap (face pixmap) "Set face pixmap on a monochrome display." - (if (and (ediff-window-display-p) (not (ediff-color-display-p))) + (if (and (ediff-window-display-p) (not (display-color-p))) (condition-case nil (set-face-background-pixmap face pixmap) (error @@ -839,14 +824,6 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-A' this variable represents.") (ediff-hide-face ediff-current-diff-face-A) -;; Until custom.el for XEmacs starts supporting :inverse-video we do this. -;; This means that some user customization may be trashed. -(and (featurep 'xemacs) - (ediff-has-face-support-p) - (not (ediff-color-display-p)) - (copy-face 'modeline ediff-current-diff-face-A)) - - (defface ediff-current-diff-B '((((class color) (min-colors 88) (background light)) @@ -869,13 +846,6 @@ this variable represents.") widget to customize the actual face `ediff-current-diff-B' this variable represents.") (ediff-hide-face ediff-current-diff-face-B) -;; Until custom.el for XEmacs starts supporting :inverse-video we do this. -;; This means that some user customization may be trashed. -(and (featurep 'xemacs) - (ediff-has-face-support-p) - (not (ediff-color-display-p)) - (copy-face 'modeline ediff-current-diff-face-B)) - (defface ediff-current-diff-C '((((class color) (min-colors 88) (background light)) @@ -897,13 +867,6 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-C' this variable represents.") (ediff-hide-face ediff-current-diff-face-C) -;; Until custom.el for XEmacs starts supporting :inverse-video we do this. -;; This means that some user customization may be trashed. -(and (featurep 'xemacs) - (ediff-has-face-support-p) - (not (ediff-color-display-p)) - (copy-face 'modeline ediff-current-diff-face-C)) - (defface ediff-current-diff-Ancestor '((((class color) (min-colors 88) (background light)) @@ -927,13 +890,6 @@ DO NOT CHANGE this variable. Instead, use the customization widget to customize the actual face object `ediff-current-diff-Ancestor' this variable represents.") (ediff-hide-face ediff-current-diff-face-Ancestor) -;; Until custom.el for XEmacs starts supporting :inverse-video we do this. -;; This means that some user customization may be trashed. -(and (featurep 'xemacs) - (ediff-has-face-support-p) - (not (ediff-color-display-p)) - (copy-face 'modeline ediff-current-diff-face-Ancestor)) - (defface ediff-fine-diff-A '((((class color) (min-colors 88) (background light)) @@ -1383,8 +1339,8 @@ This default should work without changes." overl diff-num) (mapcar (lambda (rec) (setq overl (ediff-get-diff-overlay-from-diff-record rec) - diff-num (ediff-overlay-get overl 'ediff-diff-num)) - (if (ediff-overlay-buffer overl) + diff-num (overlay-get overl 'ediff-diff-num)) + (if (overlay-buffer overl) ;; only if overlay is alive (ediff-set-overlay-face overl @@ -1410,8 +1366,8 @@ This default should work without changes." ;; this record is itself a vector (defsubst ediff-clear-fine-diff-vector (diff-record) (if diff-record - (mapc #'ediff-delete-overlay - (ediff-get-fine-diff-vector-from-diff-record diff-record)))) + (mapc #'delete-overlay + (ediff-get-fine-diff-vector-from-diff-record diff-record)))) (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type)) @@ -1425,49 +1381,37 @@ This default should work without changes." (defsubst ediff-mouse-event-p (event) - (if (featurep 'xemacs) - (button-event-p event) - (string-match "mouse" (format "%S" (event-basic-type event))))) + (string-match "mouse" (format "%S" (event-basic-type event)))) (defsubst ediff-key-press-event-p (event) - (if (featurep 'xemacs) - (key-press-event-p event) - (or (char-or-string-p event) (symbolp event)))) + (or (char-or-string-p event) (symbolp event))) (defun ediff-event-point (event) (cond ((ediff-mouse-event-p event) - (if (featurep 'xemacs) - (event-point event) - (posn-point (event-start event)))) + (posn-point (event-start event))) ((ediff-key-press-event-p event) (point)) (t (error "Error")))) (defun ediff-event-buffer (event) (cond ((ediff-mouse-event-p event) - (if (featurep 'xemacs) - (event-buffer event) - (window-buffer (posn-window (event-start event))))) + (window-buffer (posn-window (event-start event)))) ((ediff-key-press-event-p event) (current-buffer)) (t (error "Error")))) -(defun ediff-event-key (event-or-key) - (if (featurep 'xemacs) - ;;(if (eventp event-or-key) (event-key event-or-key) event-or-key) - (if (eventp event-or-key) (event-to-character event-or-key t t) event-or-key) - event-or-key)) +(define-obsolete-function-alias 'ediff-event-key #'identity "27.1") (defun ediff-last-command-char () - (ediff-event-key last-command-event)) + (declare (obsolete nil "27.1")) + last-command-event) (defsubst ediff-frame-iconified-p (frame) - (and (ediff-window-display-p) (frame-live-p frame) - (if (featurep 'xemacs) - (frame-iconified-p frame) - (eq (frame-visible-p frame) 'icon)))) + (and (ediff-window-display-p) + (frame-live-p frame) + (eq (frame-visible-p frame) 'icon))) (defsubst ediff-window-visible-p (wind) ;; under TTY, window-live-p also means window is visible @@ -1476,17 +1420,13 @@ This default should work without changes." (frame-visible-p (window-frame wind))))) -(defsubst ediff-frame-char-width (frame) - (if (featurep 'xemacs) - (/ (frame-pixel-width frame) (frame-width frame)) - (frame-char-width frame))) +(define-obsolete-function-alias 'ediff-frame-char-width + #'frame-char-width "27.1") (defun ediff-reset-mouse (&optional frame do-not-grab-mouse) (or frame (setq frame (selected-frame))) (if (ediff-window-display-p) (let ((frame-or-wind frame)) - (if (featurep 'xemacs) - (setq frame-or-wind (frame-selected-window frame))) (or do-not-grab-mouse ;; don't set mouse if the user said to never do this (not ediff-grab-mouse) @@ -1523,65 +1463,42 @@ This default should work without changes." ediff-mouse-pixel-threshold)))) (t nil)))) -(defsubst ediff-frame-char-height (frame) - (if (featurep 'xemacs) - (glyph-height ediff-H-glyph (frame-selected-window frame)) - (frame-char-height frame))) +(define-obsolete-function-alias 'ediff-frame-char-height + #'frame-char-height "27.1") ;; Some overlay functions (defsubst ediff-overlay-start (overl) - (if (ediff-overlayp overl) - (if (featurep 'xemacs) - (extent-start-position overl) - (overlay-start overl)))) + (if (overlayp overl) + (overlay-start overl))) (defsubst ediff-overlay-end (overl) - (if (ediff-overlayp overl) - (if (featurep 'xemacs) - (extent-end-position overl) - (overlay-end overl)))) + (if (overlayp overl) + (overlay-end overl))) (defsubst ediff-empty-overlay-p (overl) (= (ediff-overlay-start overl) (ediff-overlay-end overl))) -;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is -;; dead. Otherwise, works like extent-buffer -(defun ediff-overlay-buffer (overl) - (if (featurep 'xemacs) - (and (extent-live-p overl) (extent-object overl)) - (overlay-buffer overl))) +(define-obsolete-function-alias 'ediff-overlay-buffer + #'overlay-buffer "27.1") -;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is -;; dead. Otherwise, like extent-property -(defun ediff-overlay-get (overl property) - (if (featurep 'xemacs) - (and (extent-live-p overl) (extent-property overl property)) - (overlay-get overl property))) +(define-obsolete-function-alias 'ediff-overlay-get #'overlay-get "27.1") -;; These two functions are here because XEmacs refuses to -;; handle overlays whose buffers were deleted. (defun ediff-move-overlay (overlay beg end &optional buffer) - "Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs. -Checks if overlay's buffer exists before actually doing the move." - (let ((buf (and overlay (ediff-overlay-buffer overlay)))) + "If OVERLAY's buffer exists, call `move-overlay'." + (let ((buf (and overlay (overlay-buffer overlay)))) (if (ediff-buffer-live-p buf) - (if (featurep 'xemacs) - (set-extent-endpoints overlay beg end) - (move-overlay overlay beg end buffer)) + (move-overlay overlay beg end buffer) ;; buffer's dead (if overlay - (ediff-delete-overlay overlay))))) + (delete-overlay overlay))))) (defun ediff-overlay-put (overlay prop value) - "Calls `overlay-put' or `set-extent-property' depending on Emacs version. -Checks if overlay's buffer exists." - (if (ediff-buffer-live-p (ediff-overlay-buffer overlay)) - (if (featurep 'xemacs) - (set-extent-property overlay prop value) - (overlay-put overlay prop value)) - (ediff-delete-overlay overlay))) + "Calls `overlay-put', but checks if overlay's buffer exists." + (if (ediff-buffer-live-p (overlay-buffer overlay)) + (overlay-put overlay prop value) + (delete-overlay overlay))) ;; temporarily uses DIR to abbreviate file name ;; if DIR is nil, use default-directory @@ -1590,10 +1507,7 @@ Checks if overlay's buffer exists." (let ((directory-abbrev-alist (list (cons dir "")))) (abbreviate-file-name file))) (t - (if (featurep 'xemacs) - ;; XEmacs requires addl argument - (abbreviate-file-name file t) - (abbreviate-file-name file))))) + (abbreviate-file-name file)))) ;; Takes a directory and returns the parent directory. ;; does nothing to `/'. If the ARG is a regular file, diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el index 3a869bff3e..4dc0485e7e 100644 --- a/lisp/vc/ediff-mult.el +++ b/lisp/vc/ediff-mult.el @@ -471,7 +471,7 @@ Moves in circular fashion. With numeric prefix arg, skip this many items." (ediff-next-meta-item1) (setq overl (ediff-get-meta-overlay-at-pos (point))) ;; skip invisible ones - (while (and overl (ediff-overlay-get overl 'invisible)) + (while (and overl (overlay-get overl 'invisible)) (ediff-next-meta-item1) (setq overl (ediff-get-meta-overlay-at-pos (point))))))) @@ -499,7 +499,7 @@ Moves in circular fashion. With numeric prefix arg, skip this many items." (ediff-previous-meta-item1) (setq overl (ediff-get-meta-overlay-at-pos (point))) ;; skip invisible ones - (while (and overl (ediff-overlay-get overl 'invisible)) + (while (and overl (overlay-get overl 'invisible)) (ediff-previous-meta-item1) (setq overl (ediff-get-meta-overlay-at-pos (point))))))) @@ -929,7 +929,7 @@ behavior." ;; in the meta buffer. If nil, use SPC (defun ediff-replace-session-activity-marker-in-meta-buffer (point new-marker) (let* ((overl (ediff-get-meta-overlay-at-pos point)) - (session-info (ediff-overlay-get overl 'ediff-meta-info)) + (session-info (overlay-get overl 'ediff-meta-info)) (activity-marker (ediff-get-session-activity-marker session-info)) buffer-read-only) (or new-marker activity-marker (setq new-marker ?\s)) @@ -944,7 +944,7 @@ behavior." ;; the meta buffer. If nil, use SPC (defun ediff-replace-session-status-in-meta-buffer (point new-status) (let* ((overl (ediff-get-meta-overlay-at-pos point)) - (session-info (ediff-overlay-get overl 'ediff-meta-info)) + (session-info (overlay-get overl 'ediff-meta-info)) (status (ediff-get-session-status session-info)) buffer-read-only) (setq new-status (or new-status status ?\s)) @@ -988,9 +988,7 @@ behavior." (erase-buffer) ;; delete phony overlays that used to represent sessions before the buff ;; was redrawn - (if (featurep 'xemacs) - (map-extents 'delete-extent) - (mapc #'delete-overlay (overlays-in 1 1))) + (mapc #'delete-overlay (overlays-in 1 1)) (setq regexp (ediff-get-group-regexp meta-list) merge-autostore-dir @@ -1077,7 +1075,7 @@ behavior." ;; Do hiding (if overl (ediff-overlay-put overl 'invisible t))) ((and (eq (ediff-get-session-status session-info) ?H) - overl (ediff-overlay-get overl 'invisible)) + overl (overlay-get overl 'invisible)) ;; Do unhiding (ediff-overlay-put overl 'invisible nil)) (t (ediff-replace-session-activity-marker-in-meta-buffer @@ -1094,36 +1092,26 @@ behavior." (defun ediff-update-session-marker-in-dir-meta-buffer (session-num) (let (buffer-meta-overlays session-info overl buffer-read-only) - (setq overl - (if (featurep 'xemacs) - (map-extents - (lambda (ext _maparg) - (if (and - (ediff-overlay-get ext 'ediff-meta-info) - (eq (ediff-overlay-get ext 'ediff-meta-session-number) - session-num)) - ext))) - ;; Emacs doesn't have map-extents, so try harder - ;; Splice overlay lists to get all buffer overlays - (setq buffer-meta-overlays (overlay-lists) - buffer-meta-overlays (append (car buffer-meta-overlays) - (cdr buffer-meta-overlays))) - (car - (delq nil - (mapcar - (lambda (overl) - (if (and - (ediff-overlay-get overl 'ediff-meta-info) - (eq (ediff-overlay-get - overl 'ediff-meta-session-number) - session-num)) - overl)) - buffer-meta-overlays))))) + ;; Splice overlay lists to get all buffer overlays + (setq buffer-meta-overlays (overlay-lists) + buffer-meta-overlays (append (car buffer-meta-overlays) + (cdr buffer-meta-overlays))) + (setq overl (car + (delq nil + (mapcar + (lambda (overl) + (if (and + (overlay-get overl 'ediff-meta-info) + (eq (overlay-get + overl 'ediff-meta-session-number) + session-num)) + overl)) + buffer-meta-overlays)))) (or overl (error "Bug in ediff-update-session-marker-in-dir-meta-buffer: no overlay with given number %S" session-num)) - (setq session-info (ediff-overlay-get overl 'ediff-meta-info)) + (setq session-info (overlay-get overl 'ediff-meta-info)) (goto-char (ediff-overlay-start overl)) (ediff-replace-session-activity-marker-in-meta-buffer (point) @@ -1434,9 +1422,7 @@ Useful commands: (erase-buffer) ;; delete phony overlays that used to represent sessions before the buff ;; was redrawn - (if (featurep 'xemacs) - (map-extents 'delete-extent) - (mapc #'delete-overlay (overlays-in 1 1))) + (mapc #'delete-overlay (overlays-in 1 1)) (insert (substitute-command-keys "\ This is a registry of all active Ediff sessions. @@ -1538,7 +1524,7 @@ Useful commands: ;; (SESSION-CTL-BUFFER STATUS OBJA OBJB OBJC) (defun ediff-set-meta-overlay (b e prop &optional session-number hidden) (let (overl) - (setq overl (ediff-make-overlay b e)) + (setq overl (make-overlay b e)) (ediff-overlay-put overl 'mouse-face 'highlight) (ediff-overlay-put overl 'ediff-meta-info prop) (ediff-overlay-put overl 'invisible hidden) @@ -2167,7 +2153,7 @@ all marked sessions must be active." (ediff-update-markers-in-dir-meta-buffer ediff-meta-list))) (setq overl (ediff-get-meta-overlay-at-pos (point))) ;; skip the invisible sessions - (while (and overl (ediff-overlay-get overl 'invisible)) + (while (and overl (overlay-get overl 'invisible)) (ediff-next-meta-item1) (setq overl (ediff-get-meta-overlay-at-pos (point)))) )))) @@ -2259,21 +2245,17 @@ If this is a session registry buffer then just bury it." ;; If optional NOERROR arg is given, don't report error and return nil if no ;; meta info is found on line. (defun ediff-get-meta-info (buf point &optional noerror) - (let (result olist tmp) + (let (result olist) (if (and point (ediff-buffer-live-p buf)) (ediff-with-current-buffer buf - (if (featurep 'xemacs) - (setq result - (if (setq tmp (extent-at point buf 'ediff-meta-info)) - (ediff-overlay-get tmp 'ediff-meta-info))) - (setq olist - (mapcar (lambda (elt) - (unless (overlay-get elt 'invisible) - (overlay-get elt 'ediff-meta-info))) - (overlays-at point))) - (while (and olist (null (car olist))) - (setq olist (cdr olist))) - (setq result (car olist))))) + (setq olist + (mapcar (lambda (elt) + (unless (overlay-get elt 'invisible) + (overlay-get elt 'ediff-meta-info))) + (overlays-at point))) + (while (and olist (null (car olist))) + (setq olist (cdr olist))) + (setq result (car olist)))) (or result (unless noerror (ediff-update-registry) @@ -2281,21 +2263,19 @@ If this is a session registry buffer then just bury it." (defun ediff-get-meta-overlay-at-pos (point) - (if (featurep 'xemacs) - (extent-at point (current-buffer) 'ediff-meta-info) - (let* ((overl-list (overlays-at point)) - (overl (car overl-list))) - (while (and overl (null (overlay-get overl 'ediff-meta-info))) - (setq overl-list (cdr overl-list) - overl (car overl-list))) - overl))) + (let* ((overl-list (overlays-at point)) + (overl (car overl-list))) + (while (and overl (null (overlay-get overl 'ediff-meta-info))) + (setq overl-list (cdr overl-list) + overl (car overl-list))) + overl)) (defun ediff-get-session-number-at-pos (point &optional meta-buffer) (setq meta-buffer (if (ediff-buffer-live-p meta-buffer) meta-buffer (current-buffer))) (ediff-with-current-buffer meta-buffer - (ediff-overlay-get + (overlay-get (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number))) @@ -2304,46 +2284,29 @@ If this is a session registry buffer then just bury it." (if (eobp) (goto-char (point-min)) (let ((overl (ediff-get-meta-overlay-at-pos point))) - (if (featurep 'xemacs) - (progn ; xemacs - (if overl - (setq overl (next-extent overl)) - (setq overl (next-extent (current-buffer)))) - (if overl - (extent-start-position overl) - (point-max))) - ;; emacs - (if overl - ;; note: end of current overlay is the beginning of the next one - (overlay-end overl) - (next-overlay-change point)))))) + (if overl + ;; note: end of current overlay is the beginning of the next one + (overlay-end overl) + (next-overlay-change point))))) (defun ediff-previous-meta-overlay-start (point) (if (bobp) (goto-char (point-max)) (let ((overl (ediff-get-meta-overlay-at-pos point))) - (if (featurep 'xemacs) - (progn - (if overl - (setq overl (previous-extent overl)) - (setq overl (previous-extent (current-buffer)))) - (if overl - (extent-start-position overl) - (point-min))) - (if overl (setq point (overlay-start overl))) - ;; to get to the beginning of prev overlay - (if (not (bobp)) - ;; trick to overcome an emacs bug--doesn't always find previous - ;; overlay change correctly - (setq point (1- point))) - (setq point (previous-overlay-change point)) - ;; If we are not over an overlay after subtracting 1, it means we are - ;; in the description area preceding session records. In this case, - ;; goto the top of the registry buffer. - (or (car (overlays-at point)) - (setq point (point-min))) - point)))) + (if overl (setq point (overlay-start overl))) + ;; to get to the beginning of prev overlay + (if (not (bobp)) + ;; trick to overcome an emacs bug--doesn't always find previous + ;; overlay change correctly + (setq point (1- point))) + (setq point (previous-overlay-change point)) + ;; If we are not over an overlay after subtracting 1, it means we are + ;; in the description area preceding session records. In this case, + ;; goto the top of the registry buffer. + (or (car (overlays-at point)) + (setq point (point-min))) + point))) (autoload 'ediff-patch-file-internal "ediff-ptch") @@ -2403,10 +2366,10 @@ If this is a session registry buffer then just bury it." This is used only for sessions that involve 2 or 3 files at the same time. ACTION is an optional argument that can be ?h, ?m, ?=, to mark for hiding, mark for operation, or simply indicate which are equal files. If it is nil, then -`(ediff-last-command-char)' is used to decide which action to take." +`last-command-event' is used to decide which action to take." (interactive) (if (null action) - (setq action (ediff-last-command-char))) + (setq action last-command-event)) (let ((list (cdr ediff-meta-list)) marked1 marked2 marked3 fileinfo1 fileinfo2 fileinfo3 elt) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 6b2f023a22..52a765482e 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -48,9 +48,6 @@ (require 'ediff-wind) (require 'ediff-diff) (require 'ediff-merg) -;; for compatibility with current stable version of xemacs -(if (featurep 'xemacs) - (require 'ediff-tbar)) ;;; Functions @@ -284,9 +281,6 @@ to invocation.") (make-local-variable 'window-min-height) (setq window-min-height 2) - (if (featurep 'xemacs) - (make-local-hook 'ediff-after-quit-hook-internal)) - ;; unwrap set up parameters passed as argument (while setup-parameters (set (car (car setup-parameters)) (cdr (car setup-parameters))) @@ -308,9 +302,6 @@ to invocation.") (if (string-match "buffer" (symbol-name ediff-job-name)) (setq ediff-keep-variants t)) - (if (featurep 'xemacs) - (make-local-hook 'pre-command-hook)) - (if (ediff-window-display-p) (add-hook 'pre-command-hook 'ediff-spy-after-mouse nil 'local)) (setq ediff-mouse-pixel-position (mouse-pixel-position)) @@ -417,7 +408,6 @@ to invocation.") ;; since these vars are local to control-buffer ;; These won't run if there are errors in diff (ediff-with-current-buffer ediff-buffer-A - (ediff-nuke-selective-display) (run-hooks 'ediff-prepare-buffer-hook) (if (ediff-with-current-buffer control-buffer ediff-merge-job) (setq buffer-read-only t)) @@ -431,7 +421,6 @@ to invocation.") ) (ediff-with-current-buffer ediff-buffer-B - (ediff-nuke-selective-display) (run-hooks 'ediff-prepare-buffer-hook) (if (ediff-with-current-buffer control-buffer ediff-merge-job) (setq buffer-read-only t)) @@ -445,7 +434,6 @@ to invocation.") (if ediff-3way-job (ediff-with-current-buffer ediff-buffer-C - (ediff-nuke-selective-display) ;; the merge buffer should never be narrowed ;; (it can happen if it is on rmail-mode or similar) (if (ediff-with-current-buffer control-buffer ediff-merge-job) @@ -463,7 +451,6 @@ to invocation.") (if (ediff-buffer-live-p ediff-ancestor-buffer) (ediff-with-current-buffer ediff-ancestor-buffer - (ediff-nuke-selective-display) (setq buffer-read-only t) (run-hooks 'ediff-prepare-buffer-hook) (or (memq control-buffer ediff-this-buffer-ediff-sessions) @@ -560,9 +547,6 @@ to invocation.") ediff-wide-display-p)) (set-window-dedicated-p (selected-window) t) - ;; In multiframe, toolbar is set in ediff-setup-control-frame - (if (not (ediff-multiframe-setup-p)) - (ediff-make-bottom-toolbar)) ; this checks if toolbar is requested (goto-char (point-min)) (skip-chars-forward ediff-whitespace))) @@ -773,9 +757,7 @@ Reestablish the default window display." (if (fboundp 'select-frame-set-input-focus) (select-frame-set-input-focus ediff-control-frame) (raise-frame ediff-control-frame) - (select-frame ediff-control-frame) - (and (featurep 'xemacs) (fboundp 'focus-frame) - (focus-frame ediff-control-frame)))) + (select-frame ediff-control-frame))) ;; Redisplay whatever buffers are showing, if there is a selected difference (let ((control-frame ediff-control-frame) @@ -831,7 +813,7 @@ Reestablish the default window display." (if window (progn (select-window window) - (ediff-deactivate-mark) + (deactivate-mark) (ediff-position-region (ediff-get-diff-posn buf-type 'beg nil control-buf) (ediff-get-diff-posn buf-type 'end nil control-buf) @@ -1026,7 +1008,7 @@ of the current buffer." (interactive) (ediff-barf-if-not-control-buffer) (let ((ctl-buf (if (null buf) (current-buffer))) - (buf-type (ediff-char-to-buftype (ediff-last-command-char)))) + (buf-type (ediff-char-to-buftype last-command-event))) (or buf (ediff-recenter)) (or buf (setq buf (ediff-get-buffer buf-type))) @@ -1134,10 +1116,7 @@ of the current buffer." (and (vc-backend file) (if (fboundp 'vc-state) (or (memq (vc-state file) '(edited needs-merge)) - (stringp (vc-state file))) - ;; XEmacs has no vc-state - (when (featurep 'xemacs) (vc-locking-user file))) - ))) + (stringp (vc-state file))))))) (defun ediff-file-checked-in-p (file) (and (featurep 'vc-hooks) @@ -1146,10 +1125,7 @@ of the current buffer." (if (fboundp 'vc-state) (and (not (memq (vc-state file) '(edited needs-merge))) - (not (stringp (vc-state file)))) - ;; XEmacs has no vc-state - (when (featurep 'xemacs) (not (vc-locking-user file)))) - )) + (not (stringp (vc-state file))))))) (defun ediff-file-compressed-p (file) (require 'jka-compr) @@ -1274,7 +1250,6 @@ This is especially useful when comparing buffers side-by-side." (ediff-with-current-buffer ctl-buf (modify-frame-parameters ediff-wide-display-frame ediff-wide-display-orig-parameters) - ;;(sit-for (if (featurep 'xemacs) 0.4 0)) ;; restore control buf, since ctl window may have been deleted ;; during resizing (set-buffer ctl-buf) @@ -1282,7 +1257,6 @@ This is especially useful when comparing buffers side-by-side." ediff-window-B nil) ; force update of window config (ediff-recenter 'no-rehighlight)) (funcall ediff-make-wide-display-function) - ;;(sit-for (if (featurep 'xemacs) 0.4 0)) (ediff-with-current-buffer ctl-buf (setq ediff-window-B nil) ; force update of window config (ediff-recenter 'no-rehighlight))))) @@ -1302,8 +1276,6 @@ which see." (setq window-setup-func #'ediff-setup-windows-plain) (message "ediff is now in 'plain' mode")) ((eq ediff-window-setup-function #'ediff-setup-windows-plain) - (if (ediff-in-control-buffer-p) - (ediff-kill-bottom-toolbar)) (if (and (ediff-buffer-live-p ediff-control-buffer) (window-live-p ediff-control-window)) (set-window-dedicated-p ediff-control-window nil)) @@ -1342,8 +1314,6 @@ To change the default, set the variable `ediff-use-toolbar-p', which see." (progn (or (ediff-window-display-p) (user-error "Emacs is not running as a window application")) - (if (ediff-use-toolbar-p) - (ediff-kill-bottom-toolbar)) ;; do this only after killing the toolbar (setq ediff-use-toolbar-p (not ediff-use-toolbar-p)) @@ -1357,36 +1327,8 @@ To change the default, set the variable `ediff-use-toolbar-p', which see." (ediff-recenter 'no-rehighlight))))) -;; if was using toolbar, kill it -(defun ediff-kill-bottom-toolbar () - ;; Using ctl-buffer or ediff-control-window for LOCALE does not - ;; work properly in XEmacs 19.14: we have to use - ;;(selected-frame). - ;; The problem with this is that any previous bottom-toolbar - ;; will not re-appear after our cleanup here. Is there a way - ;; to do "push" and "pop" toolbars ? --marcpa - (if (featurep 'xemacs) - (when (ediff-use-toolbar-p) - (set-specifier bottom-toolbar (list (selected-frame) nil)) - (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil))))) - -;; If wants to use toolbar, make it. -;; If not, zero the toolbar for XEmacs. -;; Do nothing for Emacs. -(defun ediff-make-bottom-toolbar (&optional frame) - (when (ediff-window-display-p) - (setq frame (or frame (selected-frame))) - (if (featurep 'xemacs) - (cond ((ediff-use-toolbar-p) ; this checks for XEmacs - (set-specifier - bottom-toolbar - (list frame (if (ediff-3way-comparison-job) - ediff-toolbar-3way ediff-toolbar))) - (set-specifier bottom-toolbar-visible-p (list frame t)) - (set-specifier bottom-toolbar-height - (list frame ediff-toolbar-height))) - ((ediff-has-toolbar-support-p) - (set-specifier bottom-toolbar-height (list frame 0))))))) +(define-obsolete-function-alias 'ediff-kill-bottom-toolbar #'ignore "27.1") +(define-obsolete-function-alias 'ediff-make-bottom-toolbar #'ignore "27.1") ;; Merging @@ -1449,15 +1391,15 @@ Used in ediff-windows/regions only." 'C ediff-visible-bounds)) ) (ediff-with-current-buffer ediff-buffer-A - (if (ediff-overlay-buffer overl-A) + (if (overlay-buffer overl-A) (narrow-to-region (ediff-overlay-start overl-A) (ediff-overlay-end overl-A)))) (ediff-with-current-buffer ediff-buffer-B - (if (ediff-overlay-buffer overl-B) + (if (overlay-buffer overl-B) (narrow-to-region (ediff-overlay-start overl-B) (ediff-overlay-end overl-B)))) - (if (and ediff-3way-job (ediff-overlay-buffer overl-C)) + (if (and ediff-3way-job (overlay-buffer overl-C)) (ediff-with-current-buffer ediff-buffer-C (narrow-to-region (ediff-overlay-start overl-C) (ediff-overlay-end overl-C)))) @@ -1540,7 +1482,7 @@ the one half of the height of window-A." (error ediff-KILLED-VITAL-BUFFER)) (ediff-operate-on-windows - (if (memq (ediff-last-command-char) '(?v ?\C-v)) + (if (memq last-command-event '(?v ?\C-v)) #'scroll-up #'scroll-down) ;; calculate argument to scroll-up/down @@ -1595,7 +1537,7 @@ the width of the A/B/C windows." ;; interactively so that they set the window's min_hscroll. ;; Otherwise, automatic hscrolling will undo the effect of ;; hscrolling. - (if (= (ediff-last-command-char) ?<) + (if (= last-command-event ?<) (lambda (arg) (let ((prefix-arg arg)) (call-interactively #'scroll-left))) @@ -1867,7 +1809,7 @@ With a prefix argument, synchronize all files around the current point position in the specified buffer." (interactive "P") (ediff-barf-if-not-control-buffer) - (let* ((buf-type (ediff-char-to-buftype (ediff-last-command-char))) + (let* ((buf-type (ediff-char-to-buftype last-command-event)) (buffer (ediff-get-buffer buf-type)) (pt (ediff-with-current-buffer buffer (point))) (diff-no (ediff-diff-at-point buf-type nil (if arg 'after))) @@ -1975,10 +1917,8 @@ determine the source and the target buffers instead of the command keys." (if (eq arg '-) (setq arg -1)) ; translate neg arg to -1 (if (numberp arg) (ediff-jump-to-difference arg)) - (let* ((key1 (aref keys 0)) - (key2 (aref keys 1)) - (char1 (ediff-event-key key1)) - (char2 (ediff-event-key key2)) + (let* ((char1 (aref keys 0)) + (char2 (aref keys 1)) ediff-verbose-p) (ediff-copy-diff ediff-current-difference (ediff-char-to-buftype char1) @@ -2209,7 +2149,7 @@ determine the target buffer instead of `ediff-last-command-char'." (if (numberp arg) (ediff-jump-to-difference arg)) (ediff-pop-diff ediff-current-difference - (ediff-char-to-buftype (or key (ediff-last-command-char)))) + (ediff-char-to-buftype (or key last-command-event))) ;; recenter with rehighlighting, but no messages (let (ediff-verbose-p) (ediff-recenter))) @@ -2233,13 +2173,13 @@ a regular expression typed in by the user." (cond ((or (and (eq ediff-skip-diff-region-function ediff-focus-on-regexp-matches-function) - (eq (ediff-last-command-char) ?f)) + (eq last-command-event ?f)) (and (eq ediff-skip-diff-region-function ediff-hide-regexp-matches-function) - (eq (ediff-last-command-char) ?h))) + (eq last-command-event ?h))) (message "Selective browsing by regexp turned off") (setq ediff-skip-diff-region-function #'ediff-show-all-diffs)) - ((eq (ediff-last-command-char) ?h) + ((eq last-command-event ?h) (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function regexp-A (read-string @@ -2277,7 +2217,7 @@ a regular expression typed in by the user." (or (string= regexp-B "") (setq ediff-regexp-hide-B regexp-B)) (or (string= regexp-C "") (setq ediff-regexp-hide-C regexp-C))) - ((eq (ediff-last-command-char) ?f) + ((eq last-command-event ?f) (setq ediff-skip-diff-region-function ediff-focus-on-regexp-matches-function regexp-A @@ -2467,12 +2407,12 @@ temporarily reverses the meaning of this variable." ;; Apply selective display to narrow or widen (ediff-visible-region) (mapc (lambda (overl) - (if (ediff-overlayp overl) - (ediff-delete-overlay overl))) + (if (overlayp overl) + (delete-overlay overl))) ediff-wide-bounds) (mapc (lambda (overl) - (if (ediff-overlayp overl) - (ediff-delete-overlay overl))) + (if (overlayp overl) + (delete-overlay overl))) ediff-narrow-bounds) ;; restore buffer mode line id's in buffer-A/B/C @@ -2619,10 +2559,6 @@ temporarily reverses the meaning of this variable." ((window-live-p ctl-wind) (delete-window ctl-wind))) - ;; Hide bottom toolbar. --marcpa - (if (not (ediff-multiframe-setup-p)) - (ediff-kill-bottom-toolbar)) - (ediff-kill-buffer-carefully ctl-buf) (if (frame-live-p main-frame) @@ -3060,9 +2996,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." (ediff-get-symbol-from-alist buf-type ediff-current-diff-overlay-alist)))) - (if (featurep 'xemacs) - (ediff-move-overlay current-diff-overlay begin end-hilit) - (ediff-move-overlay current-diff-overlay begin end-hilit buff)) + (ediff-move-overlay current-diff-overlay begin end-hilit buff) (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) ;; unhighlight the background overlay for diff n so it won't @@ -3101,8 +3035,8 @@ Hit \\[ediff-recenter] to reset the windows afterward." buf-type ediff-current-diff-overlay-alist)) (current-diff-overlay (symbol-value current-diff-overlay-var))) (ediff-paint-background-regions 'unhighlight) - (if (ediff-overlayp current-diff-overlay) - (ediff-delete-overlay current-diff-overlay)) + (if (overlayp current-diff-overlay) + (delete-overlay current-diff-overlay)) (set current-diff-overlay-var nil) ))) @@ -3351,10 +3285,10 @@ Without an argument, it saves customized diff argument, if available (ediff-barf-if-not-control-buffer) (ediff-compute-custom-diffs-maybe) (ediff-with-current-buffer - (cond ((memq (ediff-last-command-char) '(?a ?b ?c)) + (cond ((memq last-command-event '(?a ?b ?c)) (ediff-get-buffer - (ediff-char-to-buftype (ediff-last-command-char)))) - ((eq (ediff-last-command-char) ?d) + (ediff-char-to-buftype last-command-event))) + ((eq last-command-event ?d) (message "Saving diff output ...") (sit-for 1) ; let the user see the message (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer)) @@ -3440,15 +3374,14 @@ Without an argument, it saves customized diff argument, if available (defun ediff-make-cloned-buffer (buff region-name) - (ediff-make-indirect-buffer + (make-indirect-buffer buff (generate-new-buffer-name - (concat (if (stringp buff) buff (buffer-name buff)) region-name)))) - + (concat (if (stringp buff) buff (buffer-name buff)) region-name)) + 'clone)) (defun ediff-make-indirect-buffer (base-buf indirect-buf-name) - (if (featurep 'xemacs) - (make-indirect-buffer base-buf indirect-buf-name) - (make-indirect-buffer base-buf indirect-buf-name 'clone))) + (declare (obsolete make-indirect-buffer "27.1")) + (make-indirect-buffer base-buf indirect-buf-name 'clone)) ;; This function operates only from an ediff control buffer @@ -3647,14 +3580,8 @@ Ediff Control Panel to restore highlighting." (defun ediff-remove-flags-from-buffer (buffer overlay) (ediff-with-current-buffer buffer (let ((inhibit-read-only t)) - (if (featurep 'xemacs) - (ediff-overlay-put overlay 'begin-glyph nil) - (ediff-overlay-put overlay 'before-string nil)) - - (if (featurep 'xemacs) - (ediff-overlay-put overlay 'end-glyph nil) - (ediff-overlay-put overlay 'after-string nil)) - ))) + (ediff-overlay-put overlay 'before-string nil) + (ediff-overlay-put overlay 'after-string nil)))) @@ -3679,9 +3606,7 @@ Ediff Control Panel to restore highlighting." ediff-before-flag-bol ediff-before-flag-mol)))) ;; insert the flag itself - (if (featurep 'xemacs) - (ediff-overlay-put curr-overl 'begin-glyph flag) - (ediff-overlay-put curr-overl 'before-string flag)) + (ediff-overlay-put curr-overl 'before-string flag) ;; insert the flag after the difference ;; `after' must be set here, after the before-flag was inserted @@ -3695,10 +3620,7 @@ Ediff Control Panel to restore highlighting." ediff-after-flag-eol ediff-after-flag-mol)))) ;; insert the flag itself - (if (featurep 'xemacs) - (ediff-overlay-put curr-overl 'end-glyph flag) - (ediff-overlay-put curr-overl 'after-string flag)) - )) + (ediff-overlay-put curr-overl 'after-string flag))) ;;; Some diff region tests @@ -3758,7 +3680,7 @@ Ediff Control Panel to restore highlighting." this-command (1+ n) ediff-number-of-differences) (error ediff-NO-DIFFERENCES))) (setq diff-overlay (ediff-get-diff-overlay n buf-type))) - (if (not (ediff-buffer-live-p (ediff-overlay-buffer diff-overlay))) + (if (not (ediff-buffer-live-p (overlay-buffer diff-overlay))) (error ediff-KILLED-VITAL-BUFFER)) (if (eq pos 'beg) (ediff-overlay-start diff-overlay) @@ -3784,8 +3706,7 @@ Ediff Control Panel to restore highlighting." (defun ediff-clear-diff-vector (vec-var &optional fine-diffs-also) (if (vectorp (symbol-value vec-var)) (mapc (lambda (elt) - (ediff-delete-overlay - (ediff-get-diff-overlay-from-diff-record elt)) + (delete-overlay (ediff-get-diff-overlay-from-diff-record elt)) (if fine-diffs-also (ediff-clear-fine-diff-vector elt)) ) @@ -3813,19 +3734,11 @@ Ediff Control Panel to restore highlighting." (setq beg (eval beg))) (or (number-or-marker-p end) (setq end (eval end))) - (setq overl - (if (featurep 'xemacs) - (make-extent beg end buff) - ;; advance front and rear of the overlay - (make-overlay beg end buff nil 'rear-advance))) + ;; advance front and rear of the overlay + (setq overl (make-overlay beg end buff nil 'rear-advance)) ;; never detach (ediff-overlay-put overl 'evaporate nil) - ;; make overlay open-ended - ;; In emacs, it is made open ended at creation time - (when (featurep 'xemacs) - (ediff-overlay-put overl 'start-open nil) - (ediff-overlay-put overl 'end-open nil)) (ediff-overlay-put overl 'ediff-diff-num 0) overl)))) @@ -3983,7 +3896,7 @@ Ediff Control Panel to restore highlighting." (defvar ediff-buffer-name) (let ((reporter-prompt-for-summary-p t) (ctl-buf ediff-control-buffer) - (ediff-device-type (ediff-device-type)) + (ediff-device-type window-system) varlist salutation ediff-buffer-name) (setq varlist '(ediff-diff-program ediff-diff-options ediff-diff3-program ediff-diff3-options @@ -4091,22 +4004,13 @@ Mail anyway? (y or n) ") ) -(defun ediff-deactivate-mark () - (if (featurep 'xemacs) - (zmacs-deactivate-region) - (deactivate-mark))) +(define-obsolete-function-alias 'ediff-deactivate-mark #'deactivate-mark "27.1") (defun ediff-activate-mark () - (if (featurep 'xemacs) - (zmacs-activate-region) - (make-local-variable 'transient-mark-mode) - (setq mark-active 'ediff-util transient-mark-mode t))) - -(defun ediff-nuke-selective-display () - (if (featurep 'xemacs) - (nuke-selective-display) - )) + (make-local-variable 'transient-mark-mode) + (setq mark-active 'ediff-util transient-mark-mode t)) +(define-obsolete-function-alias 'ediff-nuke-selective-display #'ignore "27.1") ;; The next two are modified versions from emerge.el. ;; VARS must be a list of symbols @@ -4189,9 +4093,6 @@ Mail anyway? (y or n) ") (interactive) (ediff-barf-if-not-control-buffer) - (if (featurep 'xemacs) - (make-local-hook 'post-command-hook)) - (let ((pre-hook 'pre-command-hook) (post-hook 'post-command-hook)) (if (not (equal ediff-command-begin-time '(0 0 0))) @@ -4214,7 +4115,7 @@ Mail anyway? (y or n) ") \t\tState-of-diff:\t %S \t\tState-of-merge:\t %S " - (1+ (ediff-overlay-get (aref overl-vec 0) 'ediff-diff-num)) + (1+ (overlay-get (aref overl-vec 0) 'ediff-diff-num)) (aref overl-vec 0) ;; fine-diff-vector (if (= (length (aref overl-vec 1)) 0) diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index 7ca3941a37..028995a4e5 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el @@ -151,10 +151,6 @@ In this case, Ediff will use those frames to display these buffers." (const :tag "Split horizontally" split-window-horizontally) function)) -;; Definitions hidden from the compiler by compat wrappers. -(declare-function ediff-display-pixel-width "ediff-init") -(declare-function ediff-display-pixel-height "ediff-init") - (defconst ediff-control-frame-parameters (list '(name . "Ediff") @@ -179,11 +175,11 @@ In this case, Ediff will use those frames to display these buffers." ;; this blocks queries from window manager as to where to put ;; ediff's control frame. we put the frame outside the display, ;; so the initial frame won't jump all over the screen - (cons 'top (if (fboundp 'ediff-display-pixel-height) - (1+ (ediff-display-pixel-height)) + (cons 'top (if (fboundp 'display-pixel-height) + (1+ (display-pixel-height)) 3000)) - (cons 'left (if (fboundp 'ediff-display-pixel-width) - (1+ (ediff-display-pixel-width)) + (cons 'left (if (fboundp 'display-pixel-width) + (1+ (display-pixel-width)) 3000)) ) "Frame parameters for displaying Ediff Control Panel. @@ -219,7 +215,7 @@ This is used by the default control frame positioning function, customization of the default control frame positioning." :type 'integer) -(defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3) +(defcustom ediff-narrow-control-frame-leftward-shift 3 "The leftward shift of control frame from the right edge of buf A's frame. Measured in characters. This is used by the default control frame positioning function, @@ -276,36 +272,32 @@ into icons, regardless of the window manager." (let (event) (message "Select windows by clicking. Please click on Window %d " wind-number) - (while (not (ediff-mouse-event-p (setq event (ediff-read-event)))) + (while (not (ediff-mouse-event-p (setq event (read-event)))) (if (sit-for 1) ; if sequence of events, wait till the final word (beep 1)) (message "Please click on Window %d " wind-number)) - (ediff-read-event) ; discard event - (if (featurep 'xemacs) - (event-window event) - (posn-window (event-start event))))) + (read-event) ; discard event + (posn-window (event-start event)))) ;; Select the lowest window on the frame. (defun ediff-select-lowest-window () - (if (featurep 'xemacs) - (select-window (frame-lowest-window)) - (let* ((lowest-window (selected-window)) - (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) - (last-window (save-excursion - (other-window -1) (selected-window))) - (window-search t)) - (while window-search - (let* ((this-window (next-window)) - (next-bottom-edge - (car (cdr (cdr (cdr (window-edges this-window))))))) - (if (< bottom-edge next-bottom-edge) - (setq bottom-edge next-bottom-edge - lowest-window this-window)) - (select-window this-window) - (when (eq last-window this-window) - (select-window lowest-window) - (setq window-search nil))))))) + (let* ((lowest-window (selected-window)) + (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) + (last-window (save-excursion + (other-window -1) (selected-window))) + (window-search t)) + (while window-search + (let* ((this-window (next-window)) + (next-bottom-edge + (car (cdr (cdr (cdr (window-edges this-window))))))) + (if (< bottom-edge next-bottom-edge) + (setq bottom-edge next-bottom-edge + lowest-window this-window)) + (select-window this-window) + (when (eq last-window this-window) + (select-window lowest-window) + (setq window-search nil)))))) ;;; Common window setup routines @@ -379,11 +371,6 @@ into icons, regardless of the window manager." (switch-to-buffer buf-A) (setq wind-A (selected-window)) - ;; XEmacs used to have a lot of trouble with display - ;; It did't set things right unless we tell it to sit still - ;; 19.12 seems ok. - ;;(if (featurep 'xemacs) (sit-for 0)) - (split-window-vertically (max 2 (- (window-height) merge-window-lines))) (if (eq (selected-window) wind-A) (other-window 1)) @@ -456,11 +443,6 @@ into icons, regardless of the window manager." (window-width wind-A)) 3))) - ;; XEmacs used to have a lot of trouble with display - ;; It did't set things right unless we told it to sit still - ;; 19.12 seems ok. - ;;(if (featurep 'xemacs) (sit-for 0)) - (funcall split-window-function wind-width-or-height) (if (eq (selected-window) wind-A) @@ -935,8 +917,6 @@ create a new splittable frame if none is found." (not (ediff-frame-has-dedicated-windows (window-frame wind))) ))) -(declare-function ediff-make-bottom-toolbar "ediff-util" (&optional frame)) - ;; Prepare or refresh control frame (defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame) (let ((window-min-height 1) @@ -946,8 +926,6 @@ create a new splittable frame if none is found." fheight fwidth adjusted-parameters) (with-current-buffer ctl-buffer - (if (and (featurep 'xemacs) (featurep 'menubar)) - (set-buffer-menubar nil)) ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) (run-hooks 'ediff-before-setup-control-frame-hook)) @@ -1007,18 +985,6 @@ create a new splittable frame if none is found." '(auto-raise . t)) adjusted-parameters)) - ;; In XEmacs, buffer menubar needs to be killed before frame parameters - ;; are changed. - (if (ediff-has-toolbar-support-p) - (when (featurep 'xemacs) - (if (ediff-has-gutter-support-p) - (set-specifier top-gutter (list ctl-frame nil))) - (sit-for 0) - (set-specifier top-toolbar-height (list ctl-frame 0)) - ;;(set-specifier bottom-toolbar-height (list ctl-frame 0)) - (set-specifier left-toolbar-width (list ctl-frame 0)) - (set-specifier right-toolbar-width (list ctl-frame 0)))) - ;; As a precaution, we call modify frame parameters twice, in ;; order to make sure that at least once we do it for ;; a non-iconified frame. (It appears that in the Windows port of @@ -1026,9 +992,6 @@ create a new splittable frame if none is found." (if (eq system-type 'windows-nt) (modify-frame-parameters ctl-frame adjusted-parameters)) - ;; make or zap toolbar (if not requested) - (ediff-make-bottom-toolbar ctl-frame) - (goto-char (point-min)) (modify-frame-parameters ctl-frame adjusted-parameters) @@ -1070,12 +1033,6 @@ create a new splittable frame if none is found." (or (eq this-command 'ediff-quit) (not (eq ediff-grab-mouse t))))) - (when (featurep 'xemacs) - (with-current-buffer ctl-buffer - (make-local-hook 'select-frame-hook) - (add-hook 'select-frame-hook - #'ediff-xemacs-select-frame-hook nil 'local))) - (with-current-buffer ctl-buffer (run-hooks 'ediff-after-setup-control-frame-hook)))) @@ -1084,8 +1041,6 @@ create a new splittable frame if none is found." (ediff-with-current-buffer ctl-buffer (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) (let ((ctl-frame ediff-control-frame)) - (if (and (featurep 'xemacs) (featurep 'menubar)) - (set-buffer-menubar default-menubar)) (setq ediff-control-frame nil) (delete-frame ctl-frame)))) (if ediff-multiframe @@ -1117,23 +1072,23 @@ create a new splittable frame if none is found." ctl-frame-left (+ frame-A-left (if ediff-use-long-help-message - (* (ediff-frame-char-width ctl-frame) + (* (frame-char-width ctl-frame) (+ ediff-wide-control-frame-rightward-shift horizontal-adjustment)) - (- (* frame-A-width (ediff-frame-char-width frame-A)) - (* (ediff-frame-char-width ctl-frame) + (- (* frame-A-width (frame-char-width frame-A)) + (* (frame-char-width ctl-frame) (+ ctl-frame-width ediff-narrow-control-frame-leftward-shift horizontal-adjustment)))))) (setq ctl-frame-top (min ctl-frame-top - (- (ediff-display-pixel-height) + (- (display-pixel-height) (* 2 ctl-frame-height - (ediff-frame-char-height ctl-frame)))) + (frame-char-height ctl-frame)))) ctl-frame-left (min ctl-frame-left - (- (ediff-display-pixel-width) - (* ctl-frame-width (ediff-frame-char-width ctl-frame))))) + (- (display-pixel-width) + (* ctl-frame-width (frame-char-width ctl-frame))))) ;; keep ctl frame within the visible bounds (setq ctl-frame-top (max ctl-frame-top 1) ctl-frame-left (max ctl-frame-left 1)) @@ -1153,12 +1108,12 @@ Saves the old frame parameters in `ediff-wide-display-orig-parameters'. The frame to be resized is kept in `ediff-wide-display-frame'. This function modifies only the left margin and the width of the display. It assumes that it is called from within the control buffer." - (if (not (fboundp 'ediff-display-pixel-width)) + (if (not (fboundp 'display-pixel-width)) (user-error "Can't determine display width")) (let* ((frame-A (window-frame ediff-window-A)) (frame-A-params (frame-parameters frame-A)) - (cw (ediff-frame-char-width frame-A)) - (wd (- (/ (ediff-display-pixel-width) cw) 5))) + (cw (frame-char-width frame-A)) + (wd (- (/ (display-pixel-width) cw) 5))) (setq ediff-wide-display-orig-parameters (list (cons 'left (max 0 (eval (cdr (assoc 'left frame-A-params))))) (cons 'width (cdr (assoc 'width frame-A-params)))) @@ -1300,9 +1255,7 @@ It assumes that it is called from within the control buffer." ;; If buff is not live, return nil (defun ediff-get-visible-buffer-window (buff) (if (ediff-buffer-live-p buff) - (if (featurep 'xemacs) - (get-buffer-window buff t) - (get-buffer-window buff 'visible)))) + (get-buffer-window buff 'visible))) ;;; Functions to decide when to redraw windows diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index 20e27003da..fae694d522 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -1541,9 +1541,7 @@ arguments after setting up the Ediff buffers." "Return string describing the version of Ediff. When called interactively, displays the version." (interactive) - (if (if (featurep 'xemacs) - (interactive-p) - (called-interactively-p 'interactive)) + (if (called-interactively-p 'interactive) (message "%s" (ediff-version)) (format "Ediff %s" ediff-version))) @@ -1562,7 +1560,7 @@ With optional NODE, goes to that node." (condition-case nil (progn (pop-to-buffer (get-buffer-create "*info*")) - (info (if (featurep 'xemacs) "ediff.info" "ediff")) + (info "ediff") (if node (Info-goto-node node) (message "Type `i' to search for a specific topic")) commit 9cf8454463ab0249c3b680f892507743b3be972e Author: Eli Zaretskii Date: Sat Oct 5 16:03:43 2019 +0300 Improve documentation of Tab bars * doc/emacs/frames.texi (Menu Bars, Tool Bars, Tab Bars): Don't start index entries from a capital letter. (Tab Bars): Improve wording and indexing. * etc/NEWS: Improve documentation of Tab bars. diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 0cb9c4eb1d..2acc65c189 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1152,7 +1152,7 @@ cursor during dragging. To suppress such behavior, set the options @node Menu Bars @section Menu Bars -@cindex Menu Bar mode +@cindex menu bar mode @cindex mode, Menu Bar @findex menu-bar-mode @vindex menu-bar-mode @@ -1177,7 +1177,7 @@ menus' visual appearance. @node Tool Bars @section Tool Bars -@cindex Tool Bar mode +@cindex tool bar mode @cindex mode, Tool Bar @cindex icons, toolbar @@ -1217,50 +1217,48 @@ displayed by moving the mouse pointer to the top of the screen. @node Tab Bars @section Tab Bars -@cindex Tab Bar mode +@cindex tab bar mode @cindex mode, Tab Bar @cindex tabs, tabbar - On graphical displays and on text terminals, Emacs puts a @dfn{tab bar} -at the top of each frame, just below the menu bar. This is a row of -tabs which you can click on with the mouse to switch window configurations. + On graphical displays and on text terminals, Emacs can optionally +display a @dfn{Tab Bar} at the top of each frame, just below the menu +bar. The Tab Bar is a row of @dfn{tabs}---buttons that you can click +to switch between window configurations on that frame. - Each tab on the tab bar represents a named persistent window -configuration. Its name is composed from the names of buffers -visible in windows of the window configuration. Clicking on the -tab name switches the current window configuration to the previously -used configuration of windows and buffers. + Each tab on the Tab Bar represents a named persistent window +configuration. Its name is composed from the list of names of buffers +visible in windows of that window configuration. Clicking on the tab +switches to the window configuration recorded by the tab; it is a +configuration of windows and buffers which was previously used in the +frame when that tab was the current tab. If you are using the desktop library to save and restore your -sessions, the tabs from the tab bar are recorded in the desktop file, -together with their associated window configurations. +sessions (@pxref{Saving Emacs Sesions}), 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. @findex tab-bar-mode -@vindex 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 control the use of tab bars at startup, customize the variable @code{tab-bar-mode}. @vindex tab-bar-show -@cindex Tab Bar show - This variable is intended to toggle the tab bar automatically. -When the value is @code{t}, then @code{tab-bar-mode} is enabled when -using the commands that create new window configurations. The value -@code{1} hides the tab bar when it has only one tab, and shows it -again once more tabs are created. If @code{nil}, always keep the tab -bar hidden. In this case it's still possible to use persistent named -window configurations without using the tab bar by relying on keyboard -commands that create a new window configuration (@kbd{M-x tab-new}), -that switch windows configurations (@kbd{M-x tab-next}, @kbd{M-x -tab-list}), or delete the existing ones (@kbd{M-x tab-close}). + The variable @code{tab-bar-show} controls whether the Tab Bar mode +is turned on automatically. If the value is @code{t}, then +@code{tab-bar-mode} is enabled when using the commands that create new +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-list}, @kbd{M-x tab-close}, etc. @vindex tab-bar-new-tab-choice -@cindex Tab Bar new tab - By default, Emacs follows the same behavior as when creating frames, -to start a new tab with the current buffer, i.e. the buffer -that was current before calling the command that adds a new tab. -To start a new tab with other buffers, customize the variable + By default, a new tab starts with the current buffer that was +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}. @node Dialog Boxes diff --git a/etc/NEWS b/etc/NEWS index db90e8e5c5..cadd6d9ef4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2040,33 +2040,32 @@ file-local variable, you may need to update the value. * New Modes and Packages in Emacs 27.1 -** 'tab-bar-mode' enables the tab-bar at the top of each frame, -to switch named persistent window configurations in it using tabs. -New tab-based keybindings (similar to frame-based commands): -'C-x 6 2' creates a new tab; -'C-x 6 0' deletes the current tab; -'C-x 6 b' switches to buffer in another tab; -'C-x 6 f' and 'C-x 6 C-f' edit file in another tab; -'C-TAB' switches to the next tab; -'S-C-TAB' switches to the previous tab. - -Also it's possible to switch named persistent window configurations -without having graphical access to the tab-bar, even on a tty -or when 'tab-bar-mode' is disabled, with these commands: -'tab-new' creates a new window configuration; -'tab-close' deletes the current window configuration; -'tab-select' switches to the window configuration by its name; -'tab-previous' switches to the previous window configuration; -'tab-next' switches to the next window configuration; -'tab-list' displays a list of named window configurations for switching. - -** 'global-tab-line-mode' enables the tab-line above each window to -switch buffers in it to previous/next buffers. Selecting a previous -window-local tab is the same as running 'C-x ' (previous-buffer), -selecting a next tab switches to the tab available by 'C-x ' +** Tab Bars + ++++ +*** 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. + +The 'C-x 6' sequence is the new prefix key for tab-related commands: +'C-x 6 2' creates a new tab; 'C-x 6 0' deletes the current tab; +'C-x 6 b' switches to buffer in another tab; 'C-x 6 f' and 'C-x 6 C-f' +edit file in another tab; and 'C-TAB' and 'S-C-TAB' switch to the next +or previous tab. You can also switch between tabs and create/delete +tabs with a mouse. + +Tab-related commands are available even when the Tab-Bar mode is +disabled: by default, they enable Tab-Bar mode in that case. + +*** Tab-Line mode +The new command 'global-tab-line-mode' enables the tab-line above each +window, which you can use to switch buffers in the window. Selecting +the previous window-local tab is the same as typing 'C-x ' +(previous-buffer), selecting the next tab is the same as 'C-x ' (next-buffer). Clicking on the plus icon adds a new buffer to the -window-local tab-line of window buffers. Using the mouse wheel on the -tab-line scrolls the window buffers whose names are displayed in tabs. +window-local tab-line of buffers. Using the mouse wheel on the +tab-line scrolls tabs that display the window buffers. ** fileloop.el lets one setup multifile operations like search&replace. commit 2fa9699fd795a081420682877fc448ff2391f9bd Author: Eli Zaretskii Date: Sat Oct 5 15:02:46 2019 +0300 Fix display of cursor in obscure use case on MS-Windows * src/xdisp.c (redisplay_internal): Detect when the frame becomes garbaged inside the call to update_frame, and redraw the frame in that case. (Bug#37579) diff --git a/src/xdisp.c b/src/xdisp.c index 9d1fdecaff..f5dedc218e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -15587,6 +15587,13 @@ redisplay_internal (void) STOP_POLLING; pending |= update_frame (f, false, false); + /* On some platforms (at least MS-Windows), the + scroll_run_hook called from scrolling_window + called from update_frame could set the frame's + garbaged flag, in which case we need to + redisplay the frame. */ + if (FRAME_GARBAGED_P (f)) + goto retry_frame; f->cursor_type_changed = false; f->updated_p = true; f->inhibit_clear_image_cache = false; commit 66839a74bb74efa16f9f531e93d58cadf6ab7196 Author: Philipp Stephani Date: Sat Oct 5 13:00:08 2019 +0200 * src/fns.c (Flocale_info): Avoid fixnum overflow under ASan. diff --git a/src/fns.c b/src/fns.c index fa52e5e197..37c581f15b 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3176,8 +3176,14 @@ The data read from the system are decoded using `locale-coding-system'. */) # endif # ifdef HAVE_LANGINFO__NL_PAPER_WIDTH if (EQ (item, Qpaper)) - return list2i ((intptr_t) nl_langinfo (_NL_PAPER_WIDTH), - (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)); + /* We have to cast twice here: first to a correctly-sized integer, + then to int, because that's what nl_langinfo is documented to + return for _NO_PAPER_{WIDTH,HEIGHT}. The first cast doesn't + suffice because it could overflow an Emacs fixnum. This can + happen when running under ASan, which fills allocated but + uninitialized memory with 0xBE bytes. */ + return list2i ((int) (intptr_t) nl_langinfo (_NL_PAPER_WIDTH), + (int) (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)); # endif #endif /* HAVE_LANGINFO_CODESET*/ return Qnil; commit 7d8548a0110560c558d79c23ce2c2f9da79ab68b Author: Philipp Stephani Date: Sat Oct 5 12:34:13 2019 +0200 * src/pdumper.c (dump_buffer): Update structure hash. diff --git a/src/pdumper.c b/src/pdumper.c index 195c5556ec..ca272a2e7f 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2769,7 +2769,7 @@ dump_hash_table (struct dump_context *ctx, static dump_off dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) { -#if CHECK_STRUCTS && !defined HASH_buffer_9F2F522174 +#if CHECK_STRUCTS && !defined HASH_buffer_375A10F5E5 # error "buffer changed. See CHECK_STRUCTS comment in config.h." #endif struct buffer munged_buffer = *in_buffer; commit efd51ed04cf28a9b82334f3d4858080838e1f491 Author: Paul Eggert Date: Sat Oct 5 03:14:54 2019 -0700 Omit one more superfluous "-" in regexp Problem reported by Mattias Engdegård. * lisp/language/indian.el (gurmukhi-composable-pattern): Omit unnecessary "-". diff --git a/lisp/language/indian.el b/lisp/language/indian.el index 4013faca7c..9cbc0d843e 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -199,7 +199,7 @@ South Indian language Malayalam is supported in this language environment.")) ("A" . "\u0A03") ; SIGN VISARGA ("V" . "[\u0A05-\u0A14]") ; independent vowel ("C" . "[\u0A15-\u0A39\u0A59-\u0A5E]") ; consonant - ("Y" . "[\u0A2F-\u0A30\u0A35\u0A39]") ; YA, RA, VA, HA + ("Y" . "[\u0A2F\u0A30\u0A35\u0A39]") ; YA, RA, VA, HA ("n" . "\u0A3C") ; NUKTA ("v" . "[\u0A3E-\u0A4C]") ; vowel sign ("H" . "\u0A4D") ; VIRAMA commit 677d62093056e93163c97e675ae83c833443de42 Author: Dmitry Gutov Date: Sat Oct 5 12:32:11 2019 +0300 (project--vc-list-files): Make sure to expand file names * lisp/progmodes/project.el (project--vc-list-files): Make sure to expand file names. Turns out, Grep doesn't like abbreviated ones. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ef2499030a..c7807f3944 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -302,7 +302,7 @@ backend implementation of `project-external-roots'.") (defun project--vc-list-files (dir backend extra-ignores) (pcase backend (`Git - (let ((default-directory (file-name-as-directory dir)) + (let ((default-directory (expand-file-name (file-name-as-directory dir))) (args '("-z"))) ;; Include unregistered. (setq args (append args '("-c" "-o" "--exclude-standard"))) @@ -316,12 +316,12 @@ backend implementation of `project-external-roots'.") (format ":!:%s" i))) extra-ignores))))) (mapcar - (lambda (file) (concat dir file)) + (lambda (file) (concat default-directory file)) (split-string (apply #'vc-git--run-command-string nil "ls-files" args) "\0" t)))) (`Hg - (let ((default-directory (file-name-as-directory dir)) + (let ((default-directory (expand-file-name (file-name-as-directory dir))) args) ;; Include unregistered. (setq args (nconc args '("-mcardu" "--no-status" "-0"))) @@ -334,7 +334,7 @@ backend implementation of `project-external-roots'.") (with-temp-buffer (apply #'vc-hg-command t 0 "." "status" args) (mapcar - (lambda (s) (concat dir s)) + (lambda (s) (concat default-directory s)) (split-string (buffer-string) "\0" t))))))) (cl-defmethod project-ignores ((project (head vc)) dir) commit 9c66b09950cf2db50eb6d818656a268ef750bfe6 Author: Eli Zaretskii Date: Sat Oct 5 11:59:55 2019 +0300 Fix vertical scrolling in image-mode * lisp/image-mode.el (image-set-window-vscroll): Interpret the argument VSCROLL value in pixel units. (image-mode-reapply-winprops): Interpret the 'vscroll' property value in pixel units. (image-next-line): Scroll the image with pixel resolution. (image-eob): Set the image vscroll in pixels. (Bug#37578) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index ed796565a3..a869907669 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -121,7 +121,7 @@ otherwise it defaults to t, used for times when the buffer is not displayed." (defun image-set-window-vscroll (vscroll) (setf (image-mode-window-get 'vscroll) vscroll) - (set-window-vscroll (selected-window) vscroll)) + (set-window-vscroll (selected-window) vscroll t)) (defun image-set-window-hscroll (ncol) (setf (image-mode-window-get 'hscroll) ncol) @@ -139,7 +139,7 @@ otherwise it defaults to t, used for times when the buffer is not displayed." (vscroll (image-mode-window-get 'vscroll winprops))) (when (image-get-display-property) ;Only do it if we display an image! (if hscroll (set-window-hscroll (selected-window) hscroll)) - (if vscroll (set-window-vscroll (selected-window) vscroll)))))) + (if vscroll (set-window-vscroll (selected-window) vscroll t)))))) (defun image-mode-setup-winprops () ;; Record current scroll settings. @@ -215,16 +215,18 @@ Stop if the left edge of the image is reached." "Scroll image in current window upward by N lines. Stop if the bottom edge of the image is reached." (interactive "p") + ;; Convert N to pixels. + (setq n (* n (frame-char-height))) (cond ((= n 0) nil) ((< n 0) - (image-set-window-vscroll (max 0 (+ (window-vscroll) n)))) + (image-set-window-vscroll (max 0 (+ (window-vscroll nil t) n)))) (t (let* ((image (image-get-display-property)) - (edges (window-inside-edges)) + (edges (window-edges nil t t)) (win-height (- (nth 3 edges) (nth 1 edges))) - (img-height (ceiling (cdr (image-display-size image))))) + (img-height (ceiling (cdr (image-display-size image t))))) (image-set-window-vscroll (min (max 0 (- img-height win-height)) - (+ n (window-vscroll)))))))) + (+ n (window-vscroll nil t)))))))) (defun image-previous-line (&optional n) "Scroll image in current window downward by N lines. @@ -351,10 +353,11 @@ stopping if the top or bottom edge of the image is reached." (interactive) (let* ((image (image-get-display-property)) (edges (window-inside-edges)) + (pixel-edges (window-edges nil t t)) (win-width (- (nth 2 edges) (nth 0 edges))) (img-width (ceiling (car (image-display-size image)))) - (win-height (- (nth 3 edges) (nth 1 edges))) - (img-height (ceiling (cdr (image-display-size image))))) + (win-height (- (nth 3 pixel-edges) (nth 1 pixel-edges))) + (img-height (ceiling (cdr (image-display-size image t))))) (image-set-window-hscroll (max 0 (- img-width win-width))) (image-set-window-vscroll (max 0 (- img-height win-height)))))