all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* insert string at point with emacs-version
@ 2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
  2022-02-01 15:51 ` Jean-Christophe Helary
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: goncholden via Users list for the GNU Emacs text editor @ 2022-02-01 14:24 UTC (permalink / raw)
  To: goncholden via Users list for the GNU Emacs text editor

I am looking up documentation for emacs-version. But cannot understand the meaning of

If optional argument HERE is non-nil, insert string at point.

--------
Doc:

(emacs-version &optional HERE)

Probably introduced at or before Emacs version 19.20.

Return string describing the version of Emacs that is running.
If optional argument HERE is non-nil, insert string at point.

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

* Re: insert string at point with emacs-version
  2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
@ 2022-02-01 15:51 ` Jean-Christophe Helary
  2022-02-01 15:53 ` Robert Pluim
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Jean-Christophe Helary @ 2022-02-01 15:51 UTC (permalink / raw)
  To: goncholden; +Cc: goncholden via Users list for the GNU Emacs text editor



> On Feb 1, 2022, at 23:24, goncholden via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> 
> I am looking up documentation for emacs-version. But cannot understand the meaning of
> 
> If optional argument HERE is non-nil, insert string at point.
> 
> --------
> Doc:
> 
> (emacs-version &optional HERE)
> 
> Probably introduced at or before Emacs version 19.20.
> 
> Return string describing the version of Emacs that is running.
> If optional argument HERE is non-nil, insert string at point.

try:
(emacs-version 1)

and
(emacs-version)

and

(emacs-version nil)



-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




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

* Re: insert string at point with emacs-version
  2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
  2022-02-01 15:51 ` Jean-Christophe Helary
@ 2022-02-01 15:53 ` Robert Pluim
  2022-02-01 16:08 ` H. Dieter Wilhelm
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Robert Pluim @ 2022-02-01 15:53 UTC (permalink / raw)
  To: goncholden via Users list for the GNU Emacs text editor; +Cc: goncholden

>>>>> On Tue, 01 Feb 2022 14:24:35 +0000, goncholden via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> said:

    goncholden> I am looking up documentation for emacs-version. But cannot understand the meaning of
    goncholden> If optional argument HERE is non-nil, insert string at point.

`emacs-version' is a function that can be called with 0 or 1
argument. When calling it with 1 argument, that argument is referred
to as "HERE" in the docstring, so in

    (emacs-version t)

"HERE" equals t (and this will insert the emacs version string).

Robert
-- 



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

* Re: insert string at point with emacs-version
  2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
  2022-02-01 15:51 ` Jean-Christophe Helary
  2022-02-01 15:53 ` Robert Pluim
@ 2022-02-01 16:08 ` H. Dieter Wilhelm
  2022-02-01 16:33 ` inasprecali
  2022-02-01 17:21 ` tomas
  4 siblings, 0 replies; 11+ messages in thread
From: H. Dieter Wilhelm @ 2022-02-01 16:08 UTC (permalink / raw)
  To: goncholden via Users list for the GNU Emacs text editor; +Cc: goncholden

goncholden via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I am looking up documentation for emacs-version. But cannot understand the meaning of
>
> If optional argument HERE is non-nil, insert string at point.
>
> --------
> Doc:
>
> (emacs-version &optional HERE)
>
> Probably introduced at or before Emacs version 19.20.
>
> Return string describing the version of Emacs that is running.
> If optional argument HERE is non-nil, insert string at point.

HERE in this context means that if the argument HERE is not nil then at
the current position of the cursor (thus "here") in the current document
(buffer) the version string will be inserted.

Please contrast

  (emacs-version)  <- "Here" ;-), behind the parenthesis please do: C-x e
  (emacs-version t) <- and here as well 

or check the interactive "version" version:

  M-x version
  C-u M-x version

HTH

    Dieter

-- 
Best wishes
H. Dieter Wilhelm
Zwingenberg, Germany



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

* Re: insert string at point with emacs-version
  2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
                   ` (2 preceding siblings ...)
  2022-02-01 16:08 ` H. Dieter Wilhelm
@ 2022-02-01 16:33 ` inasprecali
  2022-02-01 17:44   ` goncholden
  2022-02-01 17:21 ` tomas
  4 siblings, 1 reply; 11+ messages in thread
From: inasprecali @ 2022-02-01 16:33 UTC (permalink / raw)
  To: goncholden,
	goncholden via Users list for the GNU Emacs text editor

goncholden via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I am looking up documentation for emacs-version. But cannot understand the meaning of
>
> If optional argument HERE is non-nil, insert string at point.
>
> --------
> Doc:
>
> (emacs-version &optional HERE)
>
> Probably introduced at or before Emacs version 19.20.
>
> Return string describing the version of Emacs that is running.
> If optional argument HERE is non-nil, insert string at point.

In Emacs jargon, "point" means something like "the current cursor
position".  Try executing (emacs-version nil) and (emacs-version t)
in a scratch buffer and see for yourself (C-x C-e runs the
command eval-last-sexp, which you may find useful for this).

When ARG is not provided or nil, emacs-version returns a string
describing your current Emacs version as a value, if ARG is not
NIL, emacs-version returns NIL and inserts said string wherever
the cursor is currently located (that is, it inserts it at point).



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

* Re: insert string at point with emacs-version
  2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
                   ` (3 preceding siblings ...)
  2022-02-01 16:33 ` inasprecali
@ 2022-02-01 17:21 ` tomas
  2022-02-01 23:15   ` Emanuel Berg via Users list for the GNU Emacs text editor
  4 siblings, 1 reply; 11+ messages in thread
From: tomas @ 2022-02-01 17:21 UTC (permalink / raw)
  To: help-gnu-emacs

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

On Tue, Feb 01, 2022 at 02:24:35PM +0000, goncholden via Users list for the GNU Emacs text editor wrote:
> I am looking up documentation for emacs-version. But cannot understand the meaning of
> 
> If optional argument HERE is non-nil, insert string at point.
> 
> --------
> Doc:
> 
> (emacs-version &optional HERE)
> 
> Probably introduced at or before Emacs version 19.20.
> 
> Return string describing the version of Emacs that is running.
> If optional argument HERE is non-nil, insert string at point.

When in a buffer (whose content is not very important to you) try:

  M-x eval-expression

Then enter

  (emacs-version 'bluntschli)

and see what happens :)

Of course, any value besides 'bluntschli will do, as long as it is not
nil.

Of course, since it doesn't make a difference, you'll use t to not
coufuse your readers.

Cheers
-- 
tomás

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* insert string at point with emacs-version
  2022-02-01 16:33 ` inasprecali
@ 2022-02-01 17:44   ` goncholden
  0 siblings, 0 replies; 11+ messages in thread
From: goncholden @ 2022-02-01 17:44 UTC (permalink / raw)
  To: inasprecali; +Cc: goncholden via Users list for the GNU Emacs text editor


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, February 1st, 2022 at 4:33 PM, inasprecali <inasprecali@disroot.org> wrote:

> goncholden via Users list for the GNU Emacs text editor
>
> help-gnu-emacs@gnu.org writes:
>
> > I am looking up documentation for emacs-version. But cannot understand the meaning of
> >
> > If optional argument HERE is non-nil, insert string at point.
> >
> > Doc:
> >
> > (emacs-version &optional HERE)
> >
> > Probably introduced at or before Emacs version 19.20.
> >
> > Return string describing the version of Emacs that is running.
> >
> > If optional argument HERE is non-nil, insert string at point.
>
> In Emacs jargon, "point" means something like "the current cursor
>
> position". Try executing (emacs-version nil) and (emacs-version t)
>
> in a scratch buffer and see for yourself (C-x C-e runs the
>
> command eval-last-sexp, which you may find useful for this).
>
> When ARG is not provided or nil, emacs-version returns a string
>
> describing your current Emacs version as a value, if ARG is not
>
> NIL, emacs-version returns NIL and inserts said string wherever
>
> the cursor is currently located (that is, it inserts it at point).

I got it, it is to print a message in buffer.



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

* insert string at point with emacs-version
@ 2022-02-01 18:23 goncholden
  2022-02-01 18:26 ` [External] : " Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: goncholden @ 2022-02-01 18:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, February 1st, 2022 at 5:54 PM, Drew Adams <drew.adams@oracle.com> wrote:

> How can I have a condition that checks whether the version
>
> is 28.0 or later

(> emacs-major-version 27)

My difficulty is about calling

(alist-get (frame--current-backround-mode nil) colors)

when (> emacs-version 28.0)

and do some other thing otherwise.




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

* RE: [External] : insert string at point with emacs-version
  2022-02-01 18:23 insert string at point with emacs-version goncholden
@ 2022-02-01 18:26 ` Drew Adams
  0 siblings, 0 replies; 11+ messages in thread
From: Drew Adams @ 2022-02-01 18:26 UTC (permalink / raw)
  To: goncholden; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

Ask Emacs:

`C-h f if'
`C-h f cond'
`C-h i', choose Elisp manual, `g Conditionals'

> My difficulty is about calling
> (alist-get (frame--current-backround-mode nil) colors)
> when (> emacs-version 28.0)
> and do some other thing otherwise.


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

* insert string at point with emacs-version
@ 2022-02-01 18:57 goncholden
  0 siblings, 0 replies; 11+ messages in thread
From: goncholden @ 2022-02-01 18:57 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, February 1st, 2022 at 6:26 PM, Drew Adams <drew.adams@oracle.com> wrote:

> Ask Emacs:
>
> `C-h f if'` C-h f cond'
>
> `C-h i', choose Elisp manual,` g Conditionals'
>
> > My difficulty is about calling
> >
> > (alist-get (frame--current-backround-mode nil) colors)
> >
> > when (> emacs-version 28.0)
> >
> > and do some other thing otherwise.


Would the use of cond in the case below make sense?

  (let* ( (colors annotation-chroma)
          (levels
	   (cond (>= emacs-version 28.0)
		 (alist-get (frame--current-backround-mode nil) colors)) ))






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

* Re: insert string at point with emacs-version
  2022-02-01 17:21 ` tomas
@ 2022-02-01 23:15   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-01 23:15 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-w3m

tomas wrote:

> When in a buffer (whose content is not very important to
> you) try:
>
>   M-x eval-expression
>
> Then enter
>
>   (emacs-version 'bluntschli)
>
> Of course, any value besides 'bluntschli will do, as long as it is not
> nil.
>
> Of course, since it doesn't make a difference, you'll use
> t to not coufuse your readers.

It is used like this, C-u M-x emacs-version RET

So type for example "I like this Emacs version the most" then
hit the above combo for, in my case

  GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo
  version 1.16.0) of 2021-12-31

There is the same for Gnus, `gnus-version'

  Gnus v5.13

and I did the same for w3m and Emacs-w3m

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   https://dataswamp.org/~incal/emacs-init/w3m/w3m-version.el

(require 'w3m)

(defun emacs-w3m-version (&optional here)
  "Version number of this version of Emacs-w3m, `emacs-w3m-version'.
If optional argument HERE is non-nil, insert string at point.
\nThis is not the version of the shell tool w3m; see `w3m-version'."
  (interactive "P")
  (if here
      (insert (message emacs-w3m-version))
    (message emacs-w3m-version) ))

(defun w3m-version (&optional here)
  "Version number of this version of w3m, `w3m-version'.
If optional argument HERE is non-nil, insert string at point.
\nThis is not the version of the Emacs browser; see `emacs-w3m-version'."
  (interactive "P")
  (if here
      (insert (message w3m-version))
    (message w3m-version) ))

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2022-02-01 23:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-01 18:23 insert string at point with emacs-version goncholden
2022-02-01 18:26 ` [External] : " Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2022-02-01 18:57 goncholden
2022-02-01 14:24 goncholden via Users list for the GNU Emacs text editor
2022-02-01 15:51 ` Jean-Christophe Helary
2022-02-01 15:53 ` Robert Pluim
2022-02-01 16:08 ` H. Dieter Wilhelm
2022-02-01 16:33 ` inasprecali
2022-02-01 17:44   ` goncholden
2022-02-01 17:21 ` tomas
2022-02-01 23:15   ` Emanuel Berg 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.