[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 23d8e4326c9 1/3: Merge from origin/emacs-30
From: |
Eli Zaretskii |
Subject: |
master 23d8e4326c9 1/3: Merge from origin/emacs-30 |
Date: |
Sat, 10 Aug 2024 04:16:38 -0400 (EDT) |
branch: master
commit 23d8e4326c9fd9904ead800c3602d85165457657
Merge: 24b7f810d84 a0406f7c12e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Merge from origin/emacs-30
a0406f7c12e ; Improve documentation of 'add-to-list'
bd6dfb97ff0 NS: Fix scroll-bar setting code (bug#72331)
---
doc/lispref/lists.texi | 7 +++++++
lisp/subr.el | 8 +++++---
src/nsterm.h | 16 ----------------
src/nsterm.m | 6 +++---
4 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index dce9115c61b..6f4d838042a 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -840,6 +840,13 @@ The argument @var{symbol} is not implicitly quoted;
@code{add-to-list}
is an ordinary function, like @code{set} and unlike @code{setq}. Quote
the argument yourself if that is what you want.
+This function is for adding elements to configuration variables such as
+@code{load-path} (@pxref{Library Search}), @code{image-load-path}
+(@pxref{Defining Images}), etc. Its code includes quite a few special
+checks for these uses, and emits warnings in support of them. For this
+reason, we recommend against using it in Lisp programs for constructing
+arbitrary lists; use @code{push} instead. @xref{List Variables}.
+
Do not use this function when @var{symbol} refers to a lexical
variable.
@end defun
diff --git a/lisp/subr.el b/lisp/subr.el
index fc847049332..9ea18ca5bff 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2384,9 +2384,11 @@ LIST-VAR should not refer to a lexical variable.
The return value is the new value of LIST-VAR.
-This is handy to add some elements to configuration variables,
-but please do not abuse it in Elisp code, where you are usually
-better off using `push' or `cl-pushnew'.
+This is meant to be used for adding elements to configuration
+variables, such as adding a directory to a path variable
+like `load-path', but please do not abuse it to construct
+arbitrary lists in Elisp code, where using `push' or `cl-pushnew'
+will get you more efficient code.
If you want to use `add-to-list' on a variable that is not
defined until a certain package is loaded, you should put the
diff --git a/src/nsterm.h b/src/nsterm.h
index a07829a36ec..6c67653705e 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1069,22 +1069,6 @@ struct x_output
styleMask:[[FRAME_NS_VIEW (f) window] styleMask]]) \
- NSHeight([[[FRAME_NS_VIEW (f) window] contentView] frame])))
-/* Compute pixel size for vertical scroll bars. */
-#define NS_SCROLL_BAR_WIDTH(f) \
- (FRAME_HAS_VERTICAL_SCROLL_BARS (f) \
- ? rint (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0 \
- ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f) \
- : (FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f))) \
- : 0)
-
-/* Compute pixel size for horizontal scroll bars. */
-#define NS_SCROLL_BAR_HEIGHT(f)
\
- (FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)
\
- ? rint (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0 \
- ? FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) \
- : (FRAME_SCROLL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f))) \
- : 0)
-
/* Difference between char-column-calculated and actual SB widths.
This is only a concern for rendering when SB on left. */
#define NS_SCROLL_BAR_ADJUST(w, f) \
diff --git a/src/nsterm.m b/src/nsterm.m
index 5c2e6446f7e..473a5e705e9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5067,7 +5067,7 @@ ns_set_vertical_scroll_bar (struct window *window,
window_box (window, ANY_AREA, 0, &window_y, 0, &window_height);
top = window_y;
height = window_height;
- width = NS_SCROLL_BAR_WIDTH (f);
+ width = WINDOW_SCROLL_BAR_AREA_WIDTH (window);
left = WINDOW_SCROLL_BAR_AREA_X (window);
r = NSMakeRect (left, top, width, height);
@@ -5161,7 +5161,7 @@ ns_set_horizontal_scroll_bar (struct window *window,
window_box (window, ANY_AREA, &window_x, 0, &window_width, 0);
left = window_x;
width = window_width;
- height = NS_SCROLL_BAR_HEIGHT (f);
+ height = WINDOW_SCROLL_BAR_AREA_HEIGHT (window);
top = WINDOW_SCROLL_BAR_AREA_Y (window);
r = NSMakeRect (left, top, width, height);
@@ -5199,7 +5199,7 @@ ns_set_horizontal_scroll_bar (struct window *window,
it fills with junk. */
if (!NILP (window->vertical_scroll_bar))
ns_clear_frame_area (f, WINDOW_SCROLL_BAR_AREA_X (window), top,
- NS_SCROLL_BAR_HEIGHT (f), height);
+ WINDOW_SCROLL_BAR_AREA_WIDTH (window), height);
if (update_p)
[bar setPosition: position portion: portion whole: whole];