all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Checking values returned by window-scroll-bars
@ 2024-05-12 22:44 Heime
  2024-05-13  5:08 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Heime @ 2024-05-12 22:44 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I want to indicate whether a WINDOW uses the frame's corresponding value.
It is not as simple as just checking (window-scroll-bars).  How can I do
it ?  

(defun window-scroll-bar-info ()

  ;; Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE
  ;; HEIGHT LINES HORIZONTAL-TYPE PERSISTENT)

  ;; If WIDTH or HEIGHT is nil, or alternatively, when VERTICAL-TYPE
  ;; or HORIZONTAL-TYPE is t, the WINDOW uses the frame's
  ;; corresponding value."

  (interactive)

  (if (window-scroll-bars)
      (message "This window has its own scroll bars enabled.")
    (message "No custom scroll bars are enabled for this window."))

    (prin1 (window-scroll-bars)))




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Checking values returned by window-scroll-bars
  2024-05-12 22:44 Checking values returned by window-scroll-bars Heime
@ 2024-05-13  5:08 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-05-13  5:08 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 12 May 2024 22:44:10 +0000
> From: Heime <heimeborgia@protonmail.com>
> 
> I want to indicate whether a WINDOW uses the frame's corresponding value.
> It is not as simple as just checking (window-scroll-bars).  How can I do
> it ?  
> 
> (defun window-scroll-bar-info ()
> 
>   ;; Value is a list of the form (WIDTH COLUMNS VERTICAL-TYPE
>   ;; HEIGHT LINES HORIZONTAL-TYPE PERSISTENT)
> 
>   ;; If WIDTH or HEIGHT is nil, or alternatively, when VERTICAL-TYPE
>   ;; or HORIZONTAL-TYPE is t, the WINDOW uses the frame's
>   ;; corresponding value."
> 
>   (interactive)
> 
>   (if (window-scroll-bars)
>       (message "This window has its own scroll bars enabled.")
>     (message "No custom scroll bars are enabled for this window."))

The results for the vertical scroll bar and the horizontal scroll bar
could be different, so it is not one result but two.

To extract members from a list, you can use the function 'nth', which
returns the Nth (zero-based) member of a list.  See its doc string and
documentation in the ELisp manual for more details.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-13  5:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-12 22:44 Checking values returned by window-scroll-bars Heime
2024-05-13  5:08 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.