unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38038@debbugs.gnu.org, spacibba@aol.com, juri@linkov.net
Subject: bug#38038: 27.0.50; Emacs freezes opening tabs.
Date: Sun, 10 Nov 2019 10:45:33 +0100	[thread overview]
Message-ID: <5f00e53b-0306-3548-5cd2-36c4c65e8740@gmx.at> (raw)
In-Reply-To: <83bltl9zai.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

 > It doesn't really matter, AFAIK, but BUFFERP is clearer, I think.

I can offer the attached patch.

martin

[-- Attachment #2: buffer-local-underline.diffs --]
[-- Type: text/plain, Size: 5097 bytes --]

--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3435,19 +3435,22 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
               unsigned long descent = s->y + s->height - s->ybase;
               unsigned long minimum_offset;
               BOOL underline_at_descent_line, use_underline_position_properties;
-              Lisp_Object val = buffer_local_value (Qunderline_minimum_offset,
-                                                    s->w->contents);
-              if (FIXNUMP (val))
-                minimum_offset = XFIXNAT (val);
-              else
-                minimum_offset = 1;
-              val = buffer_local_value (Qx_underline_at_descent_line,
-                                        s->w->contents);
-              underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound));
-              val = buffer_local_value (Qx_use_underline_position_properties,
-                                        s->w->contents);
-              use_underline_position_properties =
-		!(NILP (val) || EQ (val, Qunbound));
+	      Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE
+				 (Qunderline_minimum_offset, s->w));
+
+	      if (FIXNUMP (val))
+		minimum_offset = XFIXNAT (val);
+	      else
+		minimum_offset = 1;
+
+	      val = (WINDOW_BUFFER_LOCAL_VALUE
+		     (Qx_underline_at_descent_line, s->w));
+	      underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound));
+
+	      val = (WINDOW_BUFFER_LOCAL_VALUE
+		     (Qx_use_underline_position_properties, s->w));
+	      use_underline_position_properties
+		= !(NILP (val) || EQ (val, Qunbound));
 
               /* Use underline thickness of font, defaulting to 1.  */
               thickness = (font && font->underline_thickness > 0)
diff --git a/src/w32term.c b/src/w32term.c
index 9da0845836..d0537c67e9 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2512,20 +2512,21 @@ w32_draw_glyph_string (struct glyph_string *s)
 		  unsigned long minimum_offset;
 		  BOOL underline_at_descent_line;
 		  BOOL use_underline_position_properties;
-		  Lisp_Object val
-		    = buffer_local_value (Qunderline_minimum_offset,
-		                          s->w->contents);
+		  Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE
+				     (Qunderline_minimum_offset, s->w));
+
 		  if (FIXNUMP (val))
 		    minimum_offset = max (0, XFIXNUM (val));
 		  else
 		    minimum_offset = 1;
-		  val = buffer_local_value (Qx_underline_at_descent_line,
-					    s->w->contents);
+
+		  val = (WINDOW_BUFFER_LOCAL_VALUE
+			 (Qx_underline_at_descent_line, s->w));
 		  underline_at_descent_line
 		    = !(NILP (val) || EQ (val, Qunbound));
-		  val
-		    = buffer_local_value (Qx_use_underline_position_properties,
-					  s->w->contents);
+
+		  val = (WINDOW_BUFFER_LOCAL_VALUE
+			 (Qx_use_underline_position_properties, s->w));
 		  use_underline_position_properties
 		    = !(NILP (val) || EQ (val, Qunbound));
 
diff --git a/src/window.h b/src/window.h
index 71946a5695..8ea1b9dcf7 100644
--- a/src/window.h
+++ b/src/window.h
@@ -608,6 +608,13 @@ wset_next_buffers (struct window *w, Lisp_Object val)
    ? (W)->contents				\
    : Qnil)
 
+/* Local value of variable V in window W's buffer.  Nil if W has no
+   buffer.  */
+#define WINDOW_BUFFER_LOCAL_VALUE(V, W)		\
+  (BUFFERP ((W)->contents)			\
+   ? buffer_local_value(V, (W)->contents)	\
+   : Qnil)
+
 /* Return the canonical column width of the frame of window W.  */
 #define WINDOW_FRAME_COLUMN_WIDTH(W) \
   (FRAME_COLUMN_WIDTH (WINDOW_XFRAME ((W))))
@@ -1175,6 +1182,8 @@ extern Lisp_Object Vwindow_list;
 
 extern Lisp_Object window_list (void);
 extern Lisp_Object window_parameter (struct window *, Lisp_Object parameter);
+extern Lisp_Object window_buffer_local_value (struct window *,
+					      Lisp_Object variable);
 extern struct window *decode_live_window (Lisp_Object);
 extern struct window *decode_any_window (Lisp_Object);
 extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
diff --git a/src/xterm.c b/src/xterm.c
index 44fbd27b11..f7005804f0 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3847,20 +3847,21 @@ x_draw_glyph_string (struct glyph_string *s)
 		  unsigned long minimum_offset;
 		  bool underline_at_descent_line;
 		  bool use_underline_position_properties;
-		  Lisp_Object val
-		    = buffer_local_value (Qunderline_minimum_offset,
-					  s->w->contents);
+		  Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE
+				     (Qunderline_minimum_offset, s->w));
+
 		  if (FIXNUMP (val))
 		    minimum_offset = max (0, XFIXNUM (val));
 		  else
 		    minimum_offset = 1;
-		  val = buffer_local_value (Qx_underline_at_descent_line,
-					    s->w->contents);
+
+		  val = (WINDOW_BUFFER_LOCAL_VALUE
+			 (Qx_underline_at_descent_line, s->w));
 		  underline_at_descent_line
 		    = !(NILP (val) || EQ (val, Qunbound));
-		  val
-		    = buffer_local_value (Qx_use_underline_position_properties,
-					  s->w->contents);
+
+		  val = (WINDOW_BUFFER_LOCAL_VALUE
+			 (Qx_use_underline_position_properties, s->w));
 		  use_underline_position_properties
 		    = !(NILP (val) || EQ (val, Qunbound));
 


  reply	other threads:[~2019-11-10  9:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191102214135.lehpefr5o4cji6ca.ref@Ergus>
2019-11-02 21:41 ` bug#38038: 27.0.50; Emacs freezes opening tabs Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-02 22:20   ` Juri Linkov
2019-11-02 22:55     ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-03 20:22       ` Juri Linkov
2019-11-07 14:01     ` Eli Zaretskii
2019-11-07 14:50       ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-07 22:36       ` Juri Linkov
2019-11-08  9:21         ` martin rudalics
2019-11-08 21:39           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-08 23:08           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-09  8:09             ` martin rudalics
2019-11-09  8:28               ` Eli Zaretskii
2019-11-09  9:02                 ` martin rudalics
2019-11-09  9:25                   ` Eli Zaretskii
2019-11-10  9:45                     ` martin rudalics [this message]
2019-11-12  0:39                       ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-12  8:10                         ` martin rudalics
2019-11-12 12:20                           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2019-11-12 15:48                             ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f00e53b-0306-3548-5cd2-36c4c65e8740@gmx.at \
    --to=rudalics@gmx.at \
    --cc=38038@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).