File 0007-Workaround-Bug-70385-Revert-Support-tooltips-for-fri.patch of Package emacs

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Sun, 14 Apr 2024 23:26:27 +0300
Subject: [PATCH] Workaround Bug#70385 Revert "Support tooltips for fringe
 indicators"

This reverts commit 5734047b812639c06c90eb3baf82ff502db59fb5.
---
 doc/lispref/display.texi |   4 -
 doc/lispref/text.texi    | 162 ---------------------------------------
 etc/NEWS                 |  47 ------------
 etc/TODO                 |   4 +
 src/frame.c              |   2 -
 src/xdisp.c              |  83 +-------------------
 6 files changed, 7 insertions(+), 295 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index fba15578f4f927e4047314020d8c7fad8c966269..f82c2fad14db24a12c3a1fda3e63219cad198ffd 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5501,10 +5501,6 @@ Other Display Specs
 colors are to be used for the bitmap display.  @xref{Fringe Bitmaps},
 for the details.
 
-It also possible to add context help for fringe bitmaps through the
-@code{show-help-function} mechanism by using @code{left-fringe-help} and
-@code{right-fringe-help} text properties (@pxref{Special Properties}).
-
 @item (space-width @var{factor})
 This display specification affects all the space characters within the
 text that has the specification.  It displays all of these spaces
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 07fb730f0f13aa6dcfa38a6a5a6f1586ef9ba286..18f0ee88fe59f3e645913f2bbc65aa2a5cab41c5 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3663,16 +3663,6 @@ Special Properties
 is displayed as-is by @code{show-help-function}, without being passed
 through @code{substitute-command-keys}.
 
-@item left-fringe-help
-@itemx right-fringe-help
-@cindex help-echo text on fringes
-If any visible text of a screen line has the @code{left-fringe-help} or
-@code{right-fringe-help} text property whose value is a string, then
-that string will be displayed when the mouse pointer hovers over the
-corresponding line's fringe through @code{show-help-function}
-(@pxref{Help display}).  This is useful when used together with fringe
-cursors and bitmaps (@pxref{Fringes}).
-
 @item keymap
 @cindex keymap of character
 @kindex keymap @r{(text property)}
@@ -6385,155 +6375,3 @@ Change Hooks
 use @code{combine-change-calls} or @code{combine-after-change-calls}
 instead.
 @end defvar
-
-@menu
-* Tracking changes::       Keeping track of buffer modifications.
-@end menu
-
-@node Tracking changes
-@subsection Keeping track of buffer modifications
-@cindex track-changes
-@cindex change tracker
-
-Using @code{before-change-functions} and @code{after-change-functions}
-can be difficult in practice because of a number of pitfalls, such as
-the fact that the two calls are not always properly paired, or some
-calls may be missing, either because some Emacs primitives failed to
-properly pair them or because of incorrect use of
-@code{inhibit-modification-hooks}.  Furthermore,
-many restrictions apply to those hook functions, such as the fact that
-they basically should never modify the current buffer, nor use an
-operation that may block, and they proceed quickly because
-some commands may call these hooks a large number of times.
-
-The Track-Changes library fundamentally provides an alternative API,
-built on top of those hooks.  Compared to @code{after-change-functions},
-the first important difference is that, instead of providing the bounds
-of the change and the previous length, it provides the bounds of the
-change and the actual previous content of that region.  The need to
-extract information from the original contents of the buffer is one of
-the main reasons why some packages need to use both
-@code{before-change-functions} and @code{after-change-functions} and
-then try to match them up.
-
-The second difference is that it decouples the notification of a change
-from the act of processing it, and it automatically combines into
-a single change operation all the changes that occur between the first
-change and the actual processing.  This makes it natural and easy to
-process the changes at a larger granularity, such as once per command,
-and eliminates most of the restrictions that apply to the usual change
-hook functions, making it possible to use blocking operations or to
-modify the buffer.
-
-To start tracking changes, you have to call
-@code{track-changes-register}, passing it a @var{signal} function as
-argument.  This returns a tracker @var{id} which is used to identify
-your change tracker to the other functions of the library.
-When the buffer is modified, the library calls the @var{signal}
-function to inform you of that change and immediately starts
-accumulating subsequent changes into a single combined change.
-The @var{signal} function serves only to warn that a modification
-occurred but does not receive a description of the change.  Also the
-library will not call it again until after you retrieved the change.
-
-To retrieve changes, you need to call @code{track-changes-fetch}, which
-provides you with the bounds of the changes accumulated since the
-last call, as well as the previous content of that region.  It also
-``re-arms'' the @var{signal} function so that the library will call it
-again after the next buffer modification.
-
-@defun track-changes-register signal &key nobefore disjoint immediate
-This function creates a new @dfn{change tracker}.  Change trackers are kept
-abstract, so we refer to them as mere identities, and the function thus
-returns the tracker's @var{id}.
-
-@var{signal} is a function that the library will call to notify of
-a change.  It will sometimes call it with a single argument and
-sometimes with two.  Upon the first change to the buffer since this
-tracker last called @code{track-changes-fetch}, the library calls this
-@var{signal} function with a single argument holding the @var{id} of
-the tracker.
-
-By default, the call to the @var{signal} function does not happen
-immediately, but is instead postponed with a 0 seconds timer
-(@pxref{Timers}).  This is usually desired to make sure the @var{signal}
-function is not called too frequently and runs in a permissive context,
-freeing the client from performance concerns or worries about which
-operations might be problematic.  If a client wants to have more
-control, they can provide a non-@code{nil} value as the @var{immediate}
-argument in which case the library calls the @var{signal} function
-directly from @code{after-change-functions}.  Beware that it means that
-the @var{signal} function has to be careful not to modify the buffer or
-use operations that may block.
-
-If you're not interested in the actual previous content of the buffer,
-but are using this library only for its ability to combine many small
-changes into a larger one and to delay the processing to a more
-convenient time, you can specify a non-@code{nil} value for the
-@var{nobefore} argument.  In that case, @code{track-change-fetch}
-provides you only with the length of the previous content, just like
-@code{after-change-functions}.  It also allows the library to save
-some work.
-
-While you may like to accumulate many small changes into larger ones,
-you may not want to do that if the changes are too far apart.  If you
-specify a non-@code{nil} value for the @var{disjoint} argument, the library
-will let you know when a change is about to occur ``far'' from the
-currently pending ones by calling the @var{signal} function right away,
-passing it two arguments this time: the @var{id} of the tracker, and the
-number of characters that separates the upcoming change from the
-already pending changes.  This in itself does not prevent combining this
-new change with the previous ones, so if you think the upcoming change
-is indeed too far, you need to call @code{track-change-fetch}
-right away.
-Beware that when the @var{signal} function is called because of
-a disjoint change, this happens directly from
-@code{before-change-functions}, so the usual restrictions apply about
-modifying the buffer or using operations that may block.
-@end defun
-
-@defun track-changes-fetch id func
-This is the function that lets you find out what has changed in the
-buffer.  By providing the tracker @var{id} you let the library figure
-out which changes have already been seen by your tracker.  Instead of
-returning a description of the changes, @code{track-changes-fetch} calls
-the @var{func} function with that description in the form of
-3 arguments: @var{beg}, @var{end}, and @var{before}, where
-@code{@var{beg}..@var{end}} delimit the region that was modified and
-@var{before} describes the previous content of that region.
-Usually @var{before} is a string containing the previous text of the
-modified region, but if you specified a non-@code{nil} @var{nobefore} argument
-to @code{track-changes-register}, then it is replaced by the number of
-characters of that previous text.
-
-In case no changes occurred since the last call,
-@code{track-changes-fetch} simply does not call @var{func} and returns
-@code{nil}.  If changes did occur, it calls @var{func} and returns the value
-returned by @var{func}.  But note that @var{func} is called just once
-regardless of how many changes occurred: those are summarized into
-a single @var{beg}/@var{end}/@var{before} triplet.
-
-In some cases, the library is not properly notified of all changes,
-for example because of a bug in the low-level C code or because of an
-improper use of @code{inhibit-modification-hooks}.  When it detects such
-a problem, @var{func} receives a @code{@var{beg}..@var{end}} region
-which covers the whole buffer and the @var{before} argument is the
-symbol @code{error} to indicate that the library was unable to determine
-what was changed.
-
-Once @var{func} finishes, @code{track-changes-fetch} re-enables the
-@var{signal} function so that it will be called the next time a change
-occurs.  This is the reason why it calls @var{func} instead of returning
-a description: it lets you process the change without worrying about the
-risk that the @var{signal} function gets triggered in the middle of it,
-because the @var{signal} is re-enabled only after @var{func} finishes.
-@end defun
-
-@defun track-changes-unregister id
-This function tells the library that the tracker @var{id} does not need
-to know about buffer changes any more.  Most clients will never want to
-stop tracking changes, but for clients such as minor modes, it is
-important to call this function when the minor mode is disabled,
-otherwise the tracker will keep accumulating changes and consume more
-and more resources.
-@end defun
diff --git a/etc/NEWS b/etc/NEWS
index 99f33a7b8dd4ce0f093d0c6f00c9104b4381c831..e90c439d26c61766ea344475336d9143fa8fca23 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -15,12 +15,6 @@ in older Emacs versions.
 You can narrow news to a specific version by calling 'view-emacs-news'
 with a prefix argument or by typing 'C-u C-h C-n'.
 
-Temporary note:
-+++ indicates that all relevant manuals in doc/ have been updated.
---- means no change in the manuals is needed.
-When you add a new item, use the appropriate mark if you are sure it
-applies, and please also update docstrings as needed.
-
 
 * Installation Changes in Emacs 30.1
 
@@ -1510,16 +1504,6 @@ macros with many lines, such as from 'kmacro-edit-lossage'.
 The user option 'proced-auto-update-flag' can now be set to 2 additional
 values, which control automatic updates of Proced buffers that are not
 displayed in some window.
-** Kmacro Menu Mode
-
-+++
-*** New mode 'kmacro-menu-mode' and new command 'list-keyboard-macros'.
-The new command 'list-keyboard-macros' is the keyboard-macro version
-of commands like 'list-buffers' and 'list-processes', creating a listing
-of the currently existing keyboards macros using the new mode
-'kmacro-menu-mode'.  It allows rearranging the macros in the ring,
-duplicating them, deleting them, and editing their counters, formats,
-and keys.
 
 ** Miscellaneous
 
@@ -1606,18 +1590,6 @@ options of GNU 'ls'.
 
 * New Modes and Packages in Emacs 30.1
 
-+++
-** New package Track-Changes.
-This library is a layer of abstraction above 'before-change-functions'
-and 'after-change-functions' which provides a superset of
-the functionality of 'after-change-functions':
-- It provides the actual previous text rather than only its length.
-- It takes care of accumulating and bundling changes until a time when
-  its client finds it convenient to react to them.
-- It detects most cases where some changes were not properly
-  reported (calls to 'before/after-change-functions' that are
-  incorrectly paired, missing, etc...) and reports them adequately.
-
 ** New major modes based on the tree-sitter library
 
 +++
@@ -1690,14 +1662,6 @@ documentation and examples.
 
 * Incompatible Lisp Changes in Emacs 30.1
 
-+++
-** 'define-globalized-minor-mode' requires that modes use 'run-mode-hooks'.
-Minor modes defined with 'define-globalized-minor-mode', such as
-'global-font-lock-mode', will not be enabled any more in those buffers
-whose major modes fails to use 'run-mode-hooks'.  Major modes defined
-with 'define-derived-mode' are not affected.  `run-mode-hooks` has been the
-recommended way to run major mode hooks since Emacs-22.
-
 ---
 ** Old derived.el functions removed.
 The following functions have been deleted because they were only used
@@ -1883,13 +1847,6 @@ the handler code without unwinding the stack, such that we can record
 the backtrace and other dynamic state at the point of the error.  See
 the Info node "(elisp) Handling Errors".
 
-+++
-** Tooltips on fringes.
-It is now possible to provide tooltips on fringes by adding special text
-properties 'left-fringe-help' and 'right-fringe-help'.  See the "Special
-Properties" Info node in the Emacs Lisp Reference Manual for more
-details.
-
 +++
 ** New 'pop-up-frames' action alist entry for 'display-buffer'.
 This has the same effect as the variable of the same name and takes
@@ -2103,10 +2060,6 @@ All tree-sitter enabled modes that define 'sentence' in
 
 ** Functions and variables to move by program sexps
 
-*** New function 'forward-sexp-default-function'.
-The previous implementation of 'forward-sexp' is moved into its
-own function, to be bound by 'forward-sexp-function'.
-
 *** New function 'treesit-forward-sexp'.
 Tree-sitter conditionally sets 'forward-sexp-function' for major modes
 that have defined 'sexp' in 'treesit-thing-settings' to enable
diff --git a/etc/TODO b/etc/TODO
index 21b504ad18bf47b8e8b132b793a0800edfda3f85..52c77ccc28dff971883fed658f7d7805d4b0eaf3 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -172,6 +172,10 @@ Change them to use report-emacs-bug.
 **** lm-report-bug
 **** tramp-bug
 **** c-submit-bug-report
+
+** Allow fringe indicators to display a tooltip
+Provide a help-echo property?
+
 ** Add a defcustom that supplies a function to name numeric backup files
 Like 'make-backup-file-name-function' for non-numeric backup files.
 
diff --git a/src/frame.c b/src/frame.c
index 84a14b0fb2e432acfb4126ecd06edb8ab8b25976..04b15dd6846b2131dcb6e2b46f36f1a06b0d8bbf 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6392,7 +6392,6 @@ syms_of_frame (void)
   DEFSYM (Qchild_frame_border_width, "child-frame-border-width");
   DEFSYM (Qinternal_border_width, "internal-border-width");
   DEFSYM (Qleft_fringe, "left-fringe");
-  DEFSYM (Qleft_fringe_help, "left-fringe-help");
   DEFSYM (Qline_spacing, "line-spacing");
   DEFSYM (Qmenu_bar_lines, "menu-bar-lines");
   DEFSYM (Qtab_bar_lines, "tab-bar-lines");
@@ -6400,7 +6399,6 @@ syms_of_frame (void)
   DEFSYM (Qname, "name");
   DEFSYM (Qright_divider_width, "right-divider-width");
   DEFSYM (Qright_fringe, "right-fringe");
-  DEFSYM (Qright_fringe_help, "right-fringe-help");
   DEFSYM (Qscreen_gamma, "screen-gamma");
   DEFSYM (Qscroll_bar_background, "scroll-bar-background");
   DEFSYM (Qscroll_bar_foreground, "scroll-bar-foreground");
diff --git a/src/xdisp.c b/src/xdisp.c
index d984c12d1aad181c9f0efe2e14e7163cc8b95110..140d71129f3da084ea2a98c5937c32fdecc6c831 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20202,7 +20202,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
       /* The vscroll should be preserved in this case, since
 	 `pixel-scroll-precision-mode' must continue working normally
 	 when a mini-window is resized.  (bug#55312) */
-      if (!w->preserve_vscroll_p && !window_frozen_p (w))
+      if (!w->preserve_vscroll_p || !window_frozen_p (w))
 	w->vscroll = 0;
 
       w->preserve_vscroll_p = false;
@@ -35730,79 +35730,6 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
 }
 
 
-/* Take proper action when mouse has moved to the window WINDOW, with
-   window-local x-position X and y-position Y.  This is only used for
-   displaying user-defined fringe indicator help-echo messages.  */
-
-static void
-note_fringe_highlight (struct frame *f, Lisp_Object window, int x, int y,
-		       enum window_part part)
-{
-  if (!NILP (help_echo_string) || !f->glyphs_initialized_p)
-    return;
-
-  /* When a menu is active, don't highlight because this looks odd.  */
-#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) || defined (MSDOS) \
-  || defined (HAVE_ANDROID)
-  if (popup_activated ())
-    return;
-#endif /* HAVE_X_WINDOWS || HAVE_NS || MSDOS || HAVE_ANDROID */
-
-#if defined HAVE_HAIKU
-  if (popup_activated_p)
-    return;
-#endif /* HAVE_HAIKU */
-
-  /* Find a message to display through the help-echo mechanism whenever
-     the mouse hovers over a fringe indicator.  Both text properties and
-     overlays have to be checked.  */
-
-  /* Check the text property symbol to use.  */
-  Lisp_Object sym;
-  if (part == ON_LEFT_FRINGE)
-    sym = Qleft_fringe_help;
-  else
-    sym = Qright_fringe_help;
-
-  /* Translate windows coordinates into a vertical window position.  */
-  int hpos, vpos, area;
-  struct window *w = XWINDOW (window);
-  x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, 0, 0, &area);
-
-  /* Don't access the TEXT_AREA of a row that does not display text, or
-     when the window is outdated.  (bug#70385) */
-  if (window_outdated (w)
-      || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix,
-						  vpos)))
-    return;
-
-  /* Get to the first glyph of a text row based on the vertical position
-     of the fringe.  */
-  struct glyph *glyph = MATRIX_ROW_GLYPH_START (w->current_matrix, vpos);
-  int glyph_num = MATRIX_ROW_USED (w->current_matrix, vpos);
-
-  /* Check all glyphs while looking for fringe tooltips.  */
-
-  /* NOTE: iterating over glyphs can only find text properties coming
-     from visible text.  This means that zero-length overlays and
-     invisibile text are NOT inspected.  */
-  for (; glyph_num; glyph_num--, glyph++)
-    {
-      Lisp_Object pos = make_fixnum (glyph->charpos);
-      Lisp_Object help_echo = Qnil;
-
-      if (STRINGP (glyph->object) || BUFFERP (glyph->object))
-	help_echo = get_char_property_and_overlay (pos, sym,
-						   glyph->object, NULL);
-
-      if (STRINGP (help_echo))
-	{
-	  help_echo_string = help_echo;
-	  break;
-	}
-    }
-}
-
 /* EXPORT:
    Take proper action when the mouse has moved to position X, Y on
    frame F with regards to highlighting portions of display that have
@@ -36030,12 +35957,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
       }
     else
       cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor;
-  else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE)
-    {
-      cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor;
-      note_fringe_highlight (f, window, x, y, part);
-    }
-  else if (part == ON_VERTICAL_SCROLL_BAR
+  else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
+	   || part == ON_VERTICAL_SCROLL_BAR
 	   || part == ON_HORIZONTAL_SCROLL_BAR)
     cursor = FRAME_OUTPUT_DATA (f)->nontext_cursor;
   else
openSUSE Build Service is sponsored by