unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* rx expressions
@ 2021-01-31 15:00 steve-humphreys
  2021-01-31 16:42 ` moasenwood--- via Users list for the GNU Emacs text editor
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: steve-humphreys @ 2021-01-31 15:00 UTC (permalink / raw)
  To: Help Gnu Emacs


When using rx expressions does one need to call

(require 'rx)





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

* Re: rx expressions
  2021-01-31 15:00 rx expressions steve-humphreys
@ 2021-01-31 16:42 ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-01-31 18:26 ` Michael Heerdegen
  2021-02-01  9:49 ` Philip K.
  2 siblings, 0 replies; 10+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-01-31 16:42 UTC (permalink / raw)
  To: help-gnu-emacs

steve-humphreys wrote:

> When using rx expressions does one need to call
>
> (require 'rx)

I don't know if you need to do it but it makes sense.

And if you don't, the byte-compiler will say

  geh.el: 
  In end of data:
  geh.el:292:1: Warning: the function ‘rx--charset-p’ is not
  known to be defined.

Use the byte-compiler for all you Elisp - take your game to
the next level...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: rx expressions
  2021-01-31 15:00 rx expressions steve-humphreys
  2021-01-31 16:42 ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-01-31 18:26 ` Michael Heerdegen
  2021-01-31 18:32   ` steve-humphreys
  2021-02-01  9:49 ` Philip K.
  2 siblings, 1 reply; 10+ messages in thread
From: Michael Heerdegen @ 2021-01-31 18:26 UTC (permalink / raw)
  To: help-gnu-emacs

steve-humphreys@gmx.com writes:

> When using rx expressions does one need to call
>
> (require 'rx)

Normally not: `rx' is autoloaded, and calls are expanded to strings at
compile time.

Michael.




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

* Re: rx expressions
  2021-01-31 18:26 ` Michael Heerdegen
@ 2021-01-31 18:32   ` steve-humphreys
  2021-01-31 18:53     ` Michael Heerdegen
  0 siblings, 1 reply; 10+ messages in thread
From: steve-humphreys @ 2021-01-31 18:32 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

> Sent: Monday, February 01, 2021 at 6:26 AM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: rx expressions
>
> steve-humphreys@gmx.com writes:
>
> > When using rx expressions does one need to call
> >
> > (require 'rx)
>
> Normally not: `rx' is autoloaded, and calls are expanded to strings at
> compile time.

When reading the manual, examples did not use the require command.

> Michael.
>
>
>



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

* Re: rx expressions
  2021-01-31 18:32   ` steve-humphreys
@ 2021-01-31 18:53     ` Michael Heerdegen
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Heerdegen @ 2021-01-31 18:53 UTC (permalink / raw)
  To: steve-humphreys; +Cc: help-gnu-emacs

steve-humphreys@gmx.com writes:

> > > (require 'rx)
> >
> > Normally not: `rx' is autoloaded, and calls are expanded to strings
> > at compile time.
>
> When reading the manual, examples did not use the require command.

Fine.

Michael.



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

* Re: rx expressions
  2021-01-31 15:00 rx expressions steve-humphreys
  2021-01-31 16:42 ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-01-31 18:26 ` Michael Heerdegen
@ 2021-02-01  9:49 ` Philip K.
  2021-02-01 10:01   ` moasenwood--- via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 10+ messages in thread
From: Philip K. @ 2021-02-01  9:49 UTC (permalink / raw)
  To: steve-humphreys; +Cc: Help Gnu Emacs

steve-humphreys@gmx.com writes:

> When using rx expressions does one need to call
>
> (require 'rx)

I usually add

	(eval-when-compile (require 'rx))

so that rx doesn't have to be loaded if it the file is byte-compiled,
but otherwise it's autoloaded (C-h o rx):

    rx is an autoloaded Lisp macro in ‘rx.el’.

-- 
	Philip K.



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

* Re: rx expressions
  2021-02-01  9:49 ` Philip K.
@ 2021-02-01 10:01   ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 11:27     ` Philip K.
  0 siblings, 1 reply; 10+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01 10:01 UTC (permalink / raw)
  To: help-gnu-emacs

Philip K. wrote:

> I usually add
>
> 	(eval-when-compile (require 'rx))

(eval-when-compile (require 'rx))
(rx--empty)

geh.el: 
In end of data:
geh.el:294:1: Warning: the function ‘rx--empty’ might not be defined at
    runtime.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: rx expressions
  2021-02-01 10:01   ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-01 11:27     ` Philip K.
  2021-02-01 12:10       ` moasenwood--- via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 10+ messages in thread
From: Philip K. @ 2021-02-01 11:27 UTC (permalink / raw)
  To: help-gnu-emacs

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

> Philip K. wrote:
>
>> I usually add
>>
>> 	(eval-when-compile (require 'rx))
>
> (eval-when-compile (require 'rx))
> (rx--empty)
>
> geh.el: 
> In end of data:
> geh.el:294:1: Warning: the function ‘rx--empty’ might not be defined at
>     runtime.

rx--empty is a function, so it doesn't make sense. I do
eval-when-compile when all I use is the rx macro itself.

-- 
	Philip K.



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

* Re: rx expressions
  2021-02-01 11:27     ` Philip K.
@ 2021-02-01 12:10       ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-02-01 12:19         ` steve-humphreys
  0 siblings, 1 reply; 10+ messages in thread
From: moasenwood--- via Users list for the GNU Emacs text editor @ 2021-02-01 12:10 UTC (permalink / raw)
  To: help-gnu-emacs

Philip K. wrote:

>> (eval-when-compile (require 'rx))
>> (rx--empty)
>>
>> geh.el: 
>> In end of data:
>> geh.el:294:1: Warning: the function ‘rx--empty’ might not be defined at
>>     runtime.
>
> rx--empty is a function, so it doesn't make sense. I do
> eval-when-compile when all I use is the rx macro itself.

Byte-compiling Elisp almost always makes sense, for
several reasons.

Use

  (require 'rx)

so everything is solid from the get-go and you can focus on
the byte-compiler messages that are actually useful, even
interesting to read...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: rx expressions
  2021-02-01 12:10       ` moasenwood--- via Users list for the GNU Emacs text editor
@ 2021-02-01 12:19         ` steve-humphreys
  0 siblings, 0 replies; 10+ messages in thread
From: steve-humphreys @ 2021-02-01 12:19 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

It is part of a minor mode I have written, and included the following
code.  What do you think?

(eval-when-compile
  (setq byte-compile-function-environment
        (delq (assq 'crucible-mode byte-compile-function-environment)
              byte-compile-function-environment)))



> Sent: Tuesday, February 02, 2021 at 12:10 AM
> From: "moasenwood--- via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: rx expressions
>
> Philip K. wrote:
> 
> >> (eval-when-compile (require 'rx))
> >> (rx--empty)
> >>
> >> geh.el: 
> >> In end of data:
> >> geh.el:294:1: Warning: the function ‘rx--empty’ might not be defined at
> >>     runtime.
> >
> > rx--empty is a function, so it doesn't make sense. I do
> > eval-when-compile when all I use is the rx macro itself.
> 
> Byte-compiling Elisp almost always makes sense, for
> several reasons.
> 
> Use
> 
>   (require 'rx)
> 
> so everything is solid from the get-go and you can focus on
> the byte-compiler messages that are actually useful, even
> interesting to read...
> 
> -- 
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
> 
> 
>



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

end of thread, other threads:[~2021-02-01 12:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-31 15:00 rx expressions steve-humphreys
2021-01-31 16:42 ` moasenwood--- via Users list for the GNU Emacs text editor
2021-01-31 18:26 ` Michael Heerdegen
2021-01-31 18:32   ` steve-humphreys
2021-01-31 18:53     ` Michael Heerdegen
2021-02-01  9:49 ` Philip K.
2021-02-01 10:01   ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-01 11:27     ` Philip K.
2021-02-01 12:10       ` moasenwood--- via Users list for the GNU Emacs text editor
2021-02-01 12:19         ` steve-humphreys

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