unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69784: 29.2; Proced auto update should only update visible buffers
@ 2024-03-13 21:00 Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-14  4:58 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-13 21:00 UTC (permalink / raw)
  To: 69784


Dear Emacs developers,

I use proced with 'proced-auto-update-flag' set to 't'. Often I quit the
window showing proced buffer and later some profile shows that the timer
used to update proced is taking a big chunk of time.

Since updating the proced buffer is a somewhat expensive operation, I
think the update should happen only if a proced buffer is visible.

I can send a patch to that changes 'proced-auto-update-timer' to this
effect.

Thanks,
Rahguzar


In GNU Emacs 29.2 (build 1, aarch64-redhat-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-02-02 built on
 4f70ed73c5a14276aae52125608014aa
System Description: Fedora Linux Asahi Remix 39 (Thirty Nine)

Configured using:
 'configure --build=aarch64-redhat-linux --host=aarch64-redhat-linux
 --program-prefix= --disable-dependency-tracking --prefix=/usr
 --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
 --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
 --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-cairo --with-dbus --with-gif
 --with-gpm=no --with-harfbuzz --with-jpeg --with-json --with-modules
 --with-native-compilation=aot --with-pgtk --with-png --with-rsvg
 --with-sqlite3 --with-tiff --with-tree-sitter --with-webp --with-xpm
 --with-xwidgets build_alias=aarch64-redhat-linux
 host_alias=aarch64-redhat-linux CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2
 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror=format-security
 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -mbranch-protection=standard -fasynchronous-unwind-tables
 -fstack-clash-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer ' LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++
 'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g
 -grecord-gcc-switches -pipe -Wall -Werror=format-security
 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -mbranch-protection=standard -fasynchronous-unwind-tables
 -fstack-clash-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer ''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: mu4e:main

Minor modes in effect:
  global-evil-surround-mode: t
  evil-surround-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  save-place-mode: t
  global-so-long-mode: t
  which-key-mode: t
  savehist-mode: t
  better-jumper-mode: t
  better-jumper-local-mode: t
  global-company-mode: t
  company-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  nerd-icons-completion-mode: t
  marginalia-mode: t
  evil-goggles-mode: t
  evil-escape-mode: t
  evil-snipe-override-mode: t
  evil-snipe-mode: t
  gcmh-mode: t
  winner-mode: t
  smartparens-global-mode: t
  ws-butler-global-mode: t
  undo-fu-session-global-mode: t
  undo-fu-mode: t
  satchel-mode: t
  mu4e-search-minor-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  mu4e-update-minor-mode: t
  mu4e-context-minor-mode: t
  dirvish-override-dired-mode: t
  server-mode: t
  pixel-scroll-precision-mode: t
  repeat-mode: t
  midnight-mode: t
  evil-mode: t
  evil-local-mode: t
  +popup-mode: t
  +modeline-global-mode: t
  +modeline-mode: t
  global-ligature-mode: t
  ligature-mode: t
  general-override-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  buffer-read-only: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/azeem/.emacs.d/.local/straight/build-29.2/emacsql/emacsql-sqlite-builtin hides /home/azeem/.emacs.d/.local/straight/build-29.2/emacsql-sqlite-builtin/emacsql-sqlite-builtin
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e hides /usr/share/emacs/site-lisp/mu4e/mu4e
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-window hides /usr/share/emacs/site-lisp/mu4e/mu4e-window
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-view hides /usr/share/emacs/site-lisp/mu4e/mu4e-view
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-vars hides /usr/share/emacs/site-lisp/mu4e/mu4e-vars
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-update hides /usr/share/emacs/site-lisp/mu4e/mu4e-update
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-speedbar hides /usr/share/emacs/site-lisp/mu4e/mu4e-speedbar
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-server hides /usr/share/emacs/site-lisp/mu4e/mu4e-server
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-search hides /usr/share/emacs/site-lisp/mu4e/mu4e-search
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-query-items hides /usr/share/emacs/site-lisp/mu4e/mu4e-query-items
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-org hides /usr/share/emacs/site-lisp/mu4e/mu4e-org
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-obsolete hides /usr/share/emacs/site-lisp/mu4e/mu4e-obsolete
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-notification hides /usr/share/emacs/site-lisp/mu4e/mu4e-notification
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-modeline hides /usr/share/emacs/site-lisp/mu4e/mu4e-modeline
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-message hides /usr/share/emacs/site-lisp/mu4e/mu4e-message
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-mark hides /usr/share/emacs/site-lisp/mu4e/mu4e-mark
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-main hides /usr/share/emacs/site-lisp/mu4e/mu4e-main
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-lists hides /usr/share/emacs/site-lisp/mu4e/mu4e-lists
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-icalendar hides /usr/share/emacs/site-lisp/mu4e/mu4e-icalendar
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-helpers hides /usr/share/emacs/site-lisp/mu4e/mu4e-helpers
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-headers hides /usr/share/emacs/site-lisp/mu4e/mu4e-headers
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-folders hides /usr/share/emacs/site-lisp/mu4e/mu4e-folders
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-draft hides /usr/share/emacs/site-lisp/mu4e/mu4e-draft
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-contrib hides /usr/share/emacs/site-lisp/mu4e/mu4e-contrib
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-context hides /usr/share/emacs/site-lisp/mu4e/mu4e-context
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-contacts hides /usr/share/emacs/site-lisp/mu4e/mu4e-contacts
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-config hides /usr/share/emacs/site-lisp/mu4e/mu4e-config
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-compose hides /usr/share/emacs/site-lisp/mu4e/mu4e-compose
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-bookmarks hides /usr/share/emacs/site-lisp/mu4e/mu4e-bookmarks
/home/azeem/.emacs.d/.local/straight/build-29.2/mu4e/mu4e-actions hides /usr/share/emacs/site-lisp/mu4e/mu4e-actions
/home/azeem/.emacs.d/.local/straight/build-29.2/transient/transient hides /usr/share/emacs/29.2/lisp/transient
/home/azeem/.emacs.d/.local/straight/build-29.2/ef-themes/theme-loaddefs hides /usr/share/emacs/29.2/lisp/theme-loaddefs
/home/azeem/.emacs.d/.local/straight/build-29.2/eww-hacks/shr hides /usr/share/emacs/29.2/lisp/net/shr
/home/azeem/.emacs.d/.local/straight/build-29.2/eww-hacks/eww hides /usr/share/emacs/29.2/lisp/net/eww

Features:
(shadow emacsbug descr-text consult-imenu use-package-lint
consult-flymake tabify files-x find-dired checkdoc bicycle hideshow
package-lint-flymake package-lint evil-collection-finder finder
finder-inf lisp-mnt evil-collection-package-menu doom-packages package
url-handlers highlight-quoted rainbow-delimiters highlight-numbers
parent-mode hl-todo evil-collection-elisp-mode elisp-mode
evil-collection-help evil-collection-xref xref cl-print cus-start crm
dired-x dirvish-emerge dired-aux evil-embrace embrace expand-region
text-mode-expansions the-org-mode-expansions org-element org-persist xdg
org-id org-refile avl-tree generator er-basic-expansions
expand-region-core expand-region-custom evil-surround diredfl
dirvish-subtree dirvish-icons dirvish-widgets vc-hg
evil-collection-vc-git vc-git vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
evil-collection-log-view log-view pcvs-util vc vc-dispatcher
bug-reference image-mode exif evil-collection-indent vertico-directory
evil-collection-helpful helpful cc-langs cc-vars cc-defs
evil-collection-imenu imenu trace evil-collection-edebug edebug
evil-collection-debug debug backtrace info-look evil-collection-info
info f help-fns radix-tree evil-collection-elisp-refs elisp-refs s
mastodon-notifications evil-collection-view view password-store
auth-source-pass with-editor shell gts-engine-deepl gts-implements
gts-faces gts-core guess-language flyspell company-ispell
company-yasnippet company-dabbrev delsel display-line-numbers
adaptive-wrap jit-spell ispell face-remap recentf tree-widget saveplace
evil-collection-so-long so-long whitespace jka-compr link-hint ffap
goto-addr avy cursor-sensor vertico-repeat shr-color smerge-mode diff
evil-collection-diff-mode diff-mode mm-archive gnus-fun qp sort smiley
gnus-cite mail-extr gnus-async gnus-bcklg gnus-ml disp-table nndraft
nnmh epa-file gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg nntp gnus-cache hide-mode-line fabs evil-collection-consult
consult mastodon-media textsec uni-scripts idna-mapping ucs-normalize
uni-confusable textsec-check mastodon-profile mastodon-tl network-stream
url-http url-gw nsm url-cache url-auth mastodon-auth mastodon-client
plstore mastodon mastodon-search mastodon-toot facemenu mastodon-iso
persist mastodon-http request evil-collection-which-key which-key
savehist better-jumper company-capf company vertico-multiform
evil-collection-vertico vertico orderless nerd-icons-completion
marginalia evil-goggles pulse color evil-easymotion evil-escape
evil-snipe gcmh winner smartparens-config smartparens-text smartparens
loadhist dash ws-butler undo-fu-session undo-fu satchel ibuf-ext
evil-collection-ibuffer ibuffer ibuffer-loaddefs desktop frameset
evil-collection-mu4e mu4e mu4e-org evil-collection-org smartparens-org
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete pcomplete org-list org-footnote org-faces
org-entities noutline outline ob-emacs-lisp ob-core ob-eval org-cycle
org-table ol org-fold org-fold-core org-keys oc org-loaddefs find-func
org-version org-compat org-macs mu4e-notification notifications
mu4e-main mu4e-view gnus-art mm-uu mml2015 mm-view mml-smime smime
gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus
autorevert filenotify gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win
evil-collection-gnus gnus nnheader range evil-collection-calendar
cal-menu calendar cal-loaddefs mu4e-headers mu4e-compose mu4e-draft
mu4e-actions smtpmail mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark
mu4e-message shr pixel-fill kinsoku url-file svg dom browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source url-vars
flow-fill mule-util hl-line mu4e-contacts mu4e-update mu4e-folders
mu4e-context mu4e-query-items mu4e-server mu4e-modeline mu4e-vars
mu4e-helpers mu4e-config mu4e-window evil-collection-bookmark bookmark
ido message sendmail mailcap yank-media puny dirvish transient
format-spec eieio eieio-core compat evil-collection-dired dired
dired-loaddefs rfc822 mml mml-sec password-cache evil-collection-epa epa
epg rfc6068 epg-config gnus-util time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader mu4e-obsolete server
dtrt-indent ef-spring-theme ef-themes pixel-scroll cua-base repeat
midnight html2text evil-collection-flymake flymake-proc flymake project
evil-collection-compile evil-collection-custom cus-edit cus-load
wid-edit evil-collection-comint evil-collection annalist compile
text-property-search comint ansi-osc ansi-color ibuf-macs evil
evil-integration evil-maps evil-commands reveal evil-jumps
evil-command-window evil-types evil-search evil-macros evil-repeat
evil-states evil-core advice evil-common thingatpt rect evil-vars ring
edmacro kmacro nerd-icons nerd-icons-faces nerd-icons-data
nerd-icons-data-mdicon nerd-icons-data-flicon nerd-icons-data-codicon
nerd-icons-data-devicon nerd-icons-data-sucicon nerd-icons-data-wicon
nerd-icons-data-faicon nerd-icons-data-powerline nerd-icons-data-octicon
nerd-icons-data-pomicon nerd-icons-data-ipsicon ligature derived comp
comp-cstr warnings icons rx doom-editor doom-projects doom-ui easy-mmode
doom-keybinds pp cl-extra help-mode use-package-core general tex-site
clang-rename clang-include-fixer let-alist json map byte-opt bytecomp
byte-compile clang-format xml doom-start :system doom-modules cl-seq
doom doom-lib cl-macs cl-loaddefs cl-lib gv harfbuzz jansson
dynamic-modules pcase subr-x rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1879446 210841)
 (symbols 48 88748 109)
 (strings 32 821836 14265)
 (string-bytes 1 19458729)
 (vectors 16 145471)
 (vector-slots 8 3851545 177813)
 (floats 8 1633 1636)
 (intervals 56 69302 1035)
 (buffers 984 583))





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

* bug#69784: 29.2; Proced auto update should only update visible buffers
  2024-03-13 21:00 bug#69784: 29.2; Proced auto update should only update visible buffers Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-14  4:58 ` Eli Zaretskii
  2024-03-14  8:54   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-14  4:58 UTC (permalink / raw)
  To: Rahguzar; +Cc: 69784

> Date: Wed, 13 Mar 2024 22:00:17 +0100
> From:  Rahguzar via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> I use proced with 'proced-auto-update-flag' set to 't'. Often I quit the
> window showing proced buffer and later some profile shows that the timer
> used to update proced is taking a big chunk of time.
> 
> Since updating the proced buffer is a somewhat expensive operation, I
> think the update should happen only if a proced buffer is visible.
> 
> I can send a patch to that changes 'proced-auto-update-timer' to this
> effect.

As a user option, this sounds useful.  So please do send a patch, but
please add such an option, because I can imagine users who'd like
Proced buffers to be always up-to-date, regardless of whether they are
displayed.

Thanks.





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

* bug#69784: 29.2; Proced auto update should only update visible buffers
  2024-03-14  4:58 ` Eli Zaretskii
@ 2024-03-14  8:54   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-14 11:16     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-14  8:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69784

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Wed, 13 Mar 2024 22:00:17 +0100
>> From:  Rahguzar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> I use proced with 'proced-auto-update-flag' set to 't'. Often I quit the
>> window showing proced buffer and later some profile shows that the timer
>> used to update proced is taking a big chunk of time.
>>
>> Since updating the proced buffer is a somewhat expensive operation, I
>> think the update should happen only if a proced buffer is visible.
>>
>> I can send a patch to that changes 'proced-auto-update-timer' to this
>> effect.
>
> As a user option, this sounds useful.  So please do send a patch, but
> please add such an option, because I can imagine users who'd like
> Proced buffers to be always up-to-date, regardless of whether they are
> displayed.
>
> Thanks.

What about a special value 'visible' for proced-auto-update-flag instead
of a separate option?

The only wrinkle might be how to set this value using
proced-toggle-auto-update. There is also the slight inconsistency that
it makes proced-auto-update-flag not a flag.

Rahguzar





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

* bug#69784: 29.2; Proced auto update should only update visible buffers
  2024-03-14  8:54   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-14 11:16     ` Eli Zaretskii
  2024-03-15 17:52       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-14 11:16 UTC (permalink / raw)
  To: Rahguzar; +Cc: 69784

> From: Rahguzar <rahguzar@zohomail.eu>
> Cc: 69784@debbugs.gnu.org
> Date: Thu, 14 Mar 2024 09:54:46 +0100
> 
> > As a user option, this sounds useful.  So please do send a patch, but
> > please add such an option, because I can imagine users who'd like
> > Proced buffers to be always up-to-date, regardless of whether they are
> > displayed.
> >
> > Thanks.
> 
> What about a special value 'visible' for proced-auto-update-flag instead
> of a separate option?

Yes, a good idea.

> The only wrinkle might be how to set this value using
> proced-toggle-auto-update.

Make it cycle through the values?

> There is also the slight inconsistency that it makes
> proced-auto-update-flag not a flag.

Not a catastrophe, IMO.





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

* bug#69784: 29.2; Proced auto update should only update visible buffers
  2024-03-14 11:16     ` Eli Zaretskii
@ 2024-03-15 17:52       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-28  9:51         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-15 17:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69784

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

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Rahguzar <rahguzar@zohomail.eu>
>> Cc: 69784@debbugs.gnu.org
>> Date: Thu, 14 Mar 2024 09:54:46 +0100
>>
>> > As a user option, this sounds useful.  So please do send a patch, but
>> > please add such an option, because I can imagine users who'd like
>> > Proced buffers to be always up-to-date, regardless of whether they are
>> > displayed.
>> >
>> > Thanks.
>>
>> What about a special value 'visible' for proced-auto-update-flag instead
>> of a separate option?
>
> Yes, a good idea.
>
>> The only wrinkle might be how to set this value using
>> proced-toggle-auto-update.
>
> Make it cycle through the values?

The patch I have attached does this. I am not entirely satisfied with
with proced-toggle-auto-update so suggestions for improvement are welcome.

>> There is also the slight inconsistency that it makes
>> proced-auto-update-flag not a flag.
>
> Not a catastrophe, IMO.

Thanks,
Rahguzar


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-for-only-auto-updating-visible-proced-buffers-.patch --]
[-- Type: text/x-patch, Size: 3948 bytes --]

From 0ddf3332cac4e780ae05735a91d98d52fb6fabc3 Mon Sep 17 00:00:00 2001
From: Rahguzar <rahguzar@zohomail.eu>
Date: Fri, 15 Mar 2024 18:46:46 +0100
Subject: [PATCH] Allow for only auto updating visible proced buffers
 (bug#69784)

* lisp/proced.el
(proced-auto-update-flag): document 'visible' value and add
it to the custom type.
(proced-auto-update-timer, proced-toggle-auto-update):
take 'visible' value into account.
---
 lisp/proced.el | 46 +++++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/lisp/proced.el b/lisp/proced.el
index 3435f1ab8cd..396bf4dc232 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -362,9 +362,13 @@ proced-auto-update-interval
   :type 'integer)
 
 (defcustom proced-auto-update-flag nil
-  "Non-nil for auto update of a Proced buffer.
-Can be changed interactively via `proced-toggle-auto-update'."
-  :type 'boolean)
+  "Non-nil means auto update proced buffers.
+Special value `visible' means only update proced buffers that are currently
+displayed in a window.  Can be changed interactively via
+`proced-toggle-auto-update'."
+  :type '(radio (const :tag "Don't auto update" nil)
+                (const :tag "Only update visible proced buffers" visible)
+                (const :tag "Update all proced buffers" t)))
 (make-variable-buffer-local 'proced-auto-update-flag)
 
 (defcustom proced-tree-flag nil
@@ -951,28 +955,40 @@ proced-auto-update-timer
   "Auto-update Proced buffers using `run-at-time'.
 
 If there are no proced buffers, cancel the timer."
-  (unless (seq-filter (lambda (buf)
-                        (with-current-buffer buf
-                          (when (eq major-mode 'proced-mode)
-                            (if proced-auto-update-flag
-                                (proced-update t t))
-                            t)))
-                      (buffer-list))
+  (if-let (buffers (match-buffers '(derived-mode . proced-mode)))
+      (dolist (buf buffers)
+        (when-let ((flag (buffer-local-value 'proced-auto-update-flag buf))
+                   ((or (not (eq flag 'visible))
+                        (get-buffer-window buf 'visible))))
+          (with-current-buffer buf
+            (proced-update t t))))
     (cancel-timer proced-auto-update-timer)
     (setq proced-auto-update-timer nil)))
 
 (defun proced-toggle-auto-update (arg)
   "Change whether this Proced buffer is updated automatically.
 With prefix ARG, update this buffer automatically if ARG is positive,
-otherwise do not update.  Sets the variable `proced-auto-update-flag'.
-The time interval for updates is specified via `proced-auto-update-interval'."
+update the buffer only when the buffer is displayed in a window if ARG is 0,
+otherwise do not update.  Sets the variable `proced-auto-update-flag' by
+cycling between nil, `visible' and t.  The time interval for updates is
+specified via `proced-auto-update-interval'."
   (interactive (list (or current-prefix-arg 'toggle)) proced-mode)
   (setq proced-auto-update-flag
-        (cond ((eq arg 'toggle) (not proced-auto-update-flag))
-              (arg (> (prefix-numeric-value arg) 0))
+        (cond ((eq arg 'toggle)
+               (cond ((not proced-auto-update-flag) 'visible)
+                     ((eq proced-auto-update-flag 'visible) t)
+                     (t nil)))
+              (arg
+               (setq arg (prefix-numeric-value arg))
+               (message "%s" arg)
+               (cond ((> arg 0) t)
+                     ((eq arg 0) 'visible)
+                     (t nil)))
               (t (not proced-auto-update-flag))))
   (message "Proced auto update %s"
-           (if proced-auto-update-flag "enabled" "disabled")))
+           (cond ((eq proced-auto-update-flag 'visible) "enabled (only when buffer is visible)")
+                 (proced-auto-update-flag "enabled (unconditionally)")
+                 (t "disabled"))))
 
 ;;; Mark
 
-- 
2.44.0


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

* bug#69784: 29.2; Proced auto update should only update visible buffers
  2024-03-15 17:52       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-28  9:51         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2024-03-28  9:51 UTC (permalink / raw)
  To: Rahguzar; +Cc: 69784-done

> From: Rahguzar <rahguzar@zohomail.eu>
> Cc: 69784@debbugs.gnu.org
> Date: Fri, 15 Mar 2024 18:52:53 +0100
> 
> >> What about a special value 'visible' for proced-auto-update-flag instead
> >> of a separate option?
> >
> > Yes, a good idea.
> >
> >> The only wrinkle might be how to set this value using
> >> proced-toggle-auto-update.
> >
> > Make it cycle through the values?
> 
> The patch I have attached does this. I am not entirely satisfied with
> with proced-toggle-auto-update so suggestions for improvement are welcome.
> 
> >> There is also the slight inconsistency that it makes
> >> proced-auto-update-flag not a flag.
> >
> > Not a catastrophe, IMO.

No further comments in 2 weeks, so I've now installed this on the
master branch, and I'm therefore closing this bug.

Thanks.





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

end of thread, other threads:[~2024-03-28  9:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 21:00 bug#69784: 29.2; Proced auto update should only update visible buffers Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-14  4:58 ` Eli Zaretskii
2024-03-14  8:54   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-14 11:16     ` Eli Zaretskii
2024-03-15 17:52       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28  9:51         ` Eli Zaretskii

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).