* [QUESTION] Add conditional indicator to `mode-line-misc-info' not working
@ 2024-03-07 7:30 Christopher M. Miles
2024-03-07 14:54 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Christopher M. Miles @ 2024-03-07 7:30 UTC (permalink / raw)
To: Emacs Help
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
I added bellowing init config to my Emacs:
#+begin_src emacs-lisp
(add-to-list 'mode-line-misc-info
'(image-mode (:eval (image-size (image-get-display-property) :pixels))))
#+end_src
But it's not displaying image info on mode-line when I open an image
with [M-x find-file RET /path/to/image.png RET].
I searched GitHub code for `mode-line-misc-info` examples. I don't know
what does the `image-mode` mean in upper code. Is it a condition which
only evaluate following `(:eval (image-size ...))` snippet in buffer
which major-mode is `image-mode`?
How to correctly add indicator to `mode-line-misc-info`? Please provide
some variant examples. Thanks very much.
Also the docstring of `mode-line-misc-info` is not helpful, please improve it.
My Emacs version info: GNU Emacs 30.0.50
--
[ stardiviner ]
I try to make every word tell the meaning that I want to express without misunderstanding.
Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [QUESTION] Add conditional indicator to `mode-line-misc-info' not working
2024-03-07 7:30 [QUESTION] Add conditional indicator to `mode-line-misc-info' not working Christopher M. Miles
@ 2024-03-07 14:54 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-07 15:13 ` On manuals and the Intertubes [was: Add conditional indicator to `mode-line-misc-info'] " tomas
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-03-07 14:54 UTC (permalink / raw)
To: help-gnu-emacs
> #+begin_src emacs-lisp
> (add-to-list 'mode-line-misc-info
> '(image-mode (:eval (image-size (image-get-display-property) :pixels))))
> #+end_src
>
> But it's not displaying image info on mode-line when I open an image
> with [M-x find-file RET /path/to/image.png RET].
>
> I searched GitHub code for `mode-line-misc-info` examples. I don't know
> what does the `image-mode` mean in upper code.
I know searching the 'net is fun and all, but Emacs was designed before
it, so it comes with a manual that can answer those questions even when
greed will have finished rendering the internet useless.
C-h i m elisp RET m mode line format RET m data RET
will get you to the relevant node.
> Is it a condition which only evaluate following `(:eval (image-size
> ...))` snippet in buffer which major-mode is `image-mode`?
Close, but no: it shows it only when the `image-mode` variable is non-nil.
IOW it was designed for minor modes rather than major modes.
For major modes, you usually use a buffer-local setting instead, e.g.
(add-hook 'image-mode-hook
(lambda ()
(setq mode-name `("" ,mode-name (:eval ...)))))
I used here a variable that's already used buffer-locally (another is
`mode-line-process`), which is less likely to cause surprises than if
you make `mode-line-misc-info` buffer-local.
Note also that the `:eval` thing should return a string, not a number or
a `cons`.
> How to correctly add indicator to `mode-line-misc-info`?
You could do:
(defvar-local my-indicator nil)
(unless (memq 'my-indicator mode-line-misc-info)
(setq mode-line-misc-info `("" my-indicator . ,mode-line-misc-info)))
and then
(add-hook 'image-mode-hook
(lambda ()
(setq my-indicator `(:eval ...))))
-- Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* On manuals and the Intertubes [was: Add conditional indicator to `mode-line-misc-info'] not working
2024-03-07 14:54 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-03-07 15:13 ` tomas
2024-03-07 15:34 ` Eric S Fraga
0 siblings, 1 reply; 7+ messages in thread
From: tomas @ 2024-03-07 15:13 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
On Thu, Mar 07, 2024 at 09:54:58AM -0500, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> [...] even when
> greed will have finished rendering the internet useless.
You, Sir, are a wise person. Now one question: hasn't that
happened already?
Cheers & thanks
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: On manuals and the Intertubes [was: Add conditional indicator to `mode-line-misc-info'] not working
2024-03-07 15:13 ` On manuals and the Intertubes [was: Add conditional indicator to `mode-line-misc-info'] " tomas
@ 2024-03-07 15:34 ` Eric S Fraga
2024-03-07 15:43 ` [OFFTOPIC] Re: On manuals and the Intertubes " Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2024-03-07 15:34 UTC (permalink / raw)
To: help-gnu-emacs
On Thursday, 7 Mar 2024 at 16:13, tomas@tuxteam.de wrote:
> You, Sir, are a wise person. Now one question: hasn't that
> happened already?
Not quite yet because email & nntp still work. Although some are trying
to kill email [*], of course. Recent positive news is Google leaving
the NNTP realm.
eric
[*] speaking as somebody forced to use MS Exchange aka Outlook for work.
--
Eric S Fraga via gnus (Emacs 30.0.50 2024-02-28) on Debian 12.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [OFFTOPIC] Re: On manuals and the Intertubes not working
2024-03-07 15:34 ` Eric S Fraga
@ 2024-03-07 15:43 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-07 17:07 ` Eric S Fraga
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-03-07 15:43 UTC (permalink / raw)
To: help-gnu-emacs
>> You, Sir, are a wise person. Now one question: hasn't that
>> happened already?
> Not quite yet because email & nntp still work.
And so does IRC, indeed. There are even some successor candidates, such
as Matrix and ActivityPub.
But beside the basic functionality of "being able to connect with fellow
victims", the internet can still be used to consult research
articles, to replace phone lines, and to log into your home server.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OFFTOPIC] Re: On manuals and the Intertubes not working
2024-03-07 15:43 ` [OFFTOPIC] Re: On manuals and the Intertubes " Stefan Monnier via Users list for the GNU Emacs text editor
@ 2024-03-07 17:07 ` Eric S Fraga
2024-03-07 22:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2024-03-07 17:07 UTC (permalink / raw)
To: help-gnu-emacs
On Thursday, 7 Mar 2024 at 10:43, Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> And so does IRC, indeed.
Yes, sorry: big omission on my part!
> There are even some successor candidates, such as Matrix and
> ActivityPub.
Although one could argue that these are trying to replicate things we
already have and doing so not so well, especially ActivityPub when
compared with NNTP... (IMO, of course).
> the internet can still be used to consult research articles, to
> replace phone lines, and to log into your home server.
You mean there's more to the Internet than that? I must have missed it.
;-)
--
Eric S Fraga via gnus (Emacs 30.0.50 2024-02-28) on Debian 12.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OFFTOPIC] Re: On manuals and the Intertubes not working
2024-03-07 17:07 ` Eric S Fraga
@ 2024-03-07 22:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-03-07 22:56 UTC (permalink / raw)
To: help-gnu-emacs
>> There are even some successor candidates, such as Matrix and
>> ActivityPub.
> Although one could argue that these are trying to replicate things we
> already have and doing so not so well, especially ActivityPub when
> compared with NNTP... (IMO, of course).
FWIW, I think ActivityPub does a fairly good job. I don't think it
would be straightforward to make NNTP offer comparable facilities.
This said, it's too early to see whether Lemmy and Kbin can really work
as well as NNTP, since they haven't seen much uptake yet :-(
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-03-07 22:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 7:30 [QUESTION] Add conditional indicator to `mode-line-misc-info' not working Christopher M. Miles
2024-03-07 14:54 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-07 15:13 ` On manuals and the Intertubes [was: Add conditional indicator to `mode-line-misc-info'] " tomas
2024-03-07 15:34 ` Eric S Fraga
2024-03-07 15:43 ` [OFFTOPIC] Re: On manuals and the Intertubes " Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-07 17:07 ` Eric S Fraga
2024-03-07 22:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
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.