* Re: Shorthands have landed on master
@ 2021-09-29 23:58 No Wayman
2021-09-30 2:43 ` Bodertz
0 siblings, 1 reply; 21+ messages in thread
From: No Wayman @ 2021-09-29 23:58 UTC (permalink / raw)
To: joaotavora; +Cc: emacs-devel
> Best you can do is '-loop' and '-destructuring-bind', for
> example.
I just tried using a single "-" as my shorthand.
However, it looks like it will conflict with the built-in "-".
Am I doing something wrong?
Testing with the following:
YODEL[1] REPORT [2021-09-29 20:02:54]
--8<---------------cut here---------------start------------->8---
(yodel
:post*
(yodel-file
:with*
(defun -test (x y) (- x y))
(-test 2 3)
";; Local Variables:"
";; elisp-shorthands: ((\"-\" . \"testing-\"))"
";; End:"
:then*
(eval-buffer)))
--8<---------------cut here---------------end--------------->8---
STDERR:
(void-function testing-)
Environment:
- emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu,
X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
of 2021-09-29
- system type: gnu/linux
[1] https://www.github.com/progfolio/yodel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-29 23:58 Shorthands have landed on master No Wayman @ 2021-09-30 2:43 ` Bodertz 2021-09-30 4:26 ` Michael Heerdegen 0 siblings, 1 reply; 21+ messages in thread From: Bodertz @ 2021-09-30 2:43 UTC (permalink / raw) To: emacs-devel Did you put the Local Variables part inside the function? It shouldn't be in a function. It's meant to be at the end of the file, at the top level, and not in quotes. That is, the end of your file should look like: --8<---------------cut here---------------start------------->8--- ;; Local Variables: ;; elisp-shorthands: (("-" . "testing-")) ;; End: --8<---------------cut here---------------end--------------->8--- At least I think so. I can't test that. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-30 2:43 ` Bodertz @ 2021-09-30 4:26 ` Michael Heerdegen 2021-09-30 22:08 ` Richard Stallman 0 siblings, 1 reply; 21+ messages in thread From: Michael Heerdegen @ 2021-09-30 4:26 UTC (permalink / raw) To: emacs-devel Bodertz <bodertz@gmail.com> writes: > ;; Local Variables: > ;; elisp-shorthands: (("-" . "testing-")) > ;; End: Yes, with that (read-from-string "-") -> (testing- . 1) So No Wayman was correct: Emacs doesn't like that ATM, the arithmetic function `-' is not read as such any more in the above case. Michael. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-30 4:26 ` Michael Heerdegen @ 2021-09-30 22:08 ` Richard Stallman 2021-09-30 22:11 ` João Távora 0 siblings, 1 reply; 21+ messages in thread From: Richard Stallman @ 2021-09-30 22:08 UTC (permalink / raw) To: Michael Heerdegen; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > So No Wayman was correct: Emacs doesn't like that ATM, the arithmetic > function `-' is not read as such any more in the above case. It looks like "-" as a shorthand prefix should not rename `-'. I can imagine various ways to fix this, some more general and some less general. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-30 22:08 ` Richard Stallman @ 2021-09-30 22:11 ` João Távora 2021-10-01 3:04 ` Stefan Monnier 2021-10-01 22:38 ` Richard Stallman 0 siblings, 2 replies; 21+ messages in thread From: João Távora @ 2021-09-30 22:11 UTC (permalink / raw) To: Richard Stallman; +Cc: Michael Heerdegen, emacs-devel On Thu, Sep 30, 2021 at 11:09 PM Richard Stallman <rms@gnu.org> wrote: > > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > So No Wayman was correct: Emacs doesn't like that ATM, the arithmetic > > function `-' is not read as such any more in the above case. > > It looks like "-" as a shorthand prefix should not rename `-'. I can > imagine various ways to fix this, some more general and some less > general. Yes, me too. And they would need to be put in place if we want to import Magnar Sveen's dash.el library (which uses that prefix), or any of the many libraries that depend on dash.el into Emacs, GNU Elpa or non-GNU Elpa. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-30 22:11 ` João Távora @ 2021-10-01 3:04 ` Stefan Monnier 2021-10-01 6:01 ` João Távora ` (2 more replies) 2021-10-01 22:38 ` Richard Stallman 1 sibling, 3 replies; 21+ messages in thread From: Stefan Monnier @ 2021-10-01 3:04 UTC (permalink / raw) To: João Távora; +Cc: Richard Stallman, Michael Heerdegen, emacs-devel > Yes, me too. And they would need to be put in place if we want to import > Magnar Sveen's dash.el library (which uses that prefix), or any of the many I'm not sure why but it seems that people really like to forget that `dash.el` is already in GNU ELPA. So here's yet another reminder that: `dash.el` is already in GNU ELPA. -- Stefan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-01 3:04 ` Stefan Monnier @ 2021-10-01 6:01 ` João Távora 2021-10-01 6:34 ` Thierry Volpiatto 2021-10-02 23:18 ` Richard Stallman 2 siblings, 0 replies; 21+ messages in thread From: João Távora @ 2021-10-01 6:01 UTC (permalink / raw) To: Stefan Monnier; +Cc: Michael Heerdegen, Richard Stallman, emacs-devel [-- Attachment #1: Type: text/plain, Size: 611 bytes --] On Fri, Oct 1, 2021, 04:04 Stefan Monnier <monnier@iro.umontreal.ca> wrote: > > Yes, me too. And they would need to be put in place if we want to import > > Magnar Sveen's dash.el library (which uses that prefix), or any of the > many > > I'm not sure why but it seems that people really like to forget that > `dash.el` is already in GNU ELPA. > > So here's yet another reminder that: > > `dash.el` is already in GNU ELPA. Yes, I remember now. So let's not import any other libraries that depend on that until we have the namespaces sorted, which shouldn't be long.now. João > > [-- Attachment #2: Type: text/html, Size: 1178 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-01 3:04 ` Stefan Monnier 2021-10-01 6:01 ` João Távora @ 2021-10-01 6:34 ` Thierry Volpiatto 2021-10-02 23:18 ` Richard Stallman 2 siblings, 0 replies; 21+ messages in thread From: Thierry Volpiatto @ 2021-10-01 6:34 UTC (permalink / raw) To: Stefan Monnier Cc: Michael Heerdegen, emacs-devel, João Távora, Richard Stallman Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Yes, me too. And they would need to be put in place if we want to import >> Magnar Sveen's dash.el library (which uses that prefix), or any of the many > > I'm not sure why but it seems that people really like to forget that > `dash.el` is already in GNU ELPA. I really like to forget that such package exists at all, it is a pain for the elisp reader. -- Thierry ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-01 3:04 ` Stefan Monnier 2021-10-01 6:01 ` João Távora 2021-10-01 6:34 ` Thierry Volpiatto @ 2021-10-02 23:18 ` Richard Stallman 2021-10-02 23:19 ` João Távora 2 siblings, 1 reply; 21+ messages in thread From: Richard Stallman @ 2021-10-02 23:18 UTC (permalink / raw) To: Stefan Monnier; +Cc: michael_heerdegen, joaotavora, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > `dash.el` is already in GNU ELPA. We need to modify it to use a renaming, after fixing the bug that affects "-" as prefix. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-02 23:18 ` Richard Stallman @ 2021-10-02 23:19 ` João Távora 0 siblings, 0 replies; 21+ messages in thread From: João Távora @ 2021-10-02 23:19 UTC (permalink / raw) To: Richard Stallman; +Cc: Michael Heerdegen, Stefan Monnier, emacs-devel On Sun, Oct 3, 2021 at 12:18 AM Richard Stallman <rms@gnu.org> wrote: > > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > `dash.el` is already in GNU ELPA. > > We need to modify it to use a renaming, after fixing the bug > that affects "-" as prefix. Yes. If someone has a bit of time, please create that bug in debbugs so I don't forget about it. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-30 22:11 ` João Távora 2021-10-01 3:04 ` Stefan Monnier @ 2021-10-01 22:38 ` Richard Stallman 2021-10-01 22:45 ` João Távora 1 sibling, 1 reply; 21+ messages in thread From: Richard Stallman @ 2021-10-01 22:38 UTC (permalink / raw) To: João Távora; +Cc: michael_heerdegen, emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > It looks like "-" as a shorthand prefix should not rename `-'. I can > > imagine various ways to fix this, some more general and some less > > general. > Yes, me too. And they would need to be put in place if we want to import > Magnar Sveen's dash.el library (which uses that prefix), or any of the many > libraries that depend on dash.el into Emacs, GNU Elpa or non-GNU Elpa. We certainly want to do this. Can you suggest the way to fix this problem? -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-01 22:38 ` Richard Stallman @ 2021-10-01 22:45 ` João Távora 2021-10-02 6:15 ` Eli Zaretskii 0 siblings, 1 reply; 21+ messages in thread From: João Távora @ 2021-10-01 22:45 UTC (permalink / raw) To: Richard Stallman; +Cc: Michael Heerdegen, emacs-devel On Fri, Oct 1, 2021 at 11:38 PM Richard Stallman <rms@gnu.org> wrote: > > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > > It looks like "-" as a shorthand prefix should not rename `-'. I can > > > imagine various ways to fix this, some more general and some less > > > general. > > > Yes, me too. And they would need to be put in place if we want to import > > Magnar Sveen's dash.el library (which uses that prefix), or any of the many > > libraries that depend on dash.el into Emacs, GNU Elpa or non-GNU Elpa. > > We certainly want to do this. Can you suggest the way to fix this problem? The easiest way would seem not to rename a symbol that is nothing more than the configured shorthand prefix. i.e. doesn't have a suffix. That is what happens with '-'. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-01 22:45 ` João Távora @ 2021-10-02 6:15 ` Eli Zaretskii 2021-10-02 6:50 ` João Távora 0 siblings, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-10-02 6:15 UTC (permalink / raw) To: João Távora; +Cc: michael_heerdegen, rms, emacs-devel > From: João Távora <joaotavora@gmail.com> > Date: Fri, 1 Oct 2021 23:45:10 +0100 > Cc: Michael Heerdegen <michael_heerdegen@web.de>, > emacs-devel <emacs-devel@gnu.org> > > The easiest way would seem not to rename a symbol that is nothing more than > the configured shorthand prefix. i.e. doesn't have a suffix. That is > what happens with '-'. I think I agree, but could you show a patch for that, please? ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-10-02 6:15 ` Eli Zaretskii @ 2021-10-02 6:50 ` João Távora 0 siblings, 0 replies; 21+ messages in thread From: João Távora @ 2021-10-02 6:50 UTC (permalink / raw) To: Eli Zaretskii; +Cc: michael_heerdegen, rms, emacs-devel Eli Zaretskii <eliz@gnu.org> writes: >> From: João Távora <joaotavora@gmail.com> >> Date: Fri, 1 Oct 2021 23:45:10 +0100 >> Cc: Michael Heerdegen <michael_heerdegen@web.de>, >> emacs-devel <emacs-devel@gnu.org> >> >> The easiest way would seem not to rename a symbol that is nothing more than >> the configured shorthand prefix. i.e. doesn't have a suffix. That is >> what happens with '-'. > > I think I agree, but could you show a patch for that, please? Give me some time, and remind me soon if I forget. Doesn't seem a hard thing to patch in lread.c, if others want to try a stab. An automated test should also be added. João ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <20210927003203.15806.29864@vcs0.savannah.gnu.org>]
[parent not found: <20210927003205.EF26620A5E@vcs0.savannah.gnu.org>]
* Better way to require with shorthands/renamed symbols [not found] ` <20210927003205.EF26620A5E@vcs0.savannah.gnu.org> @ 2021-09-27 11:10 ` Stefan Kangas 2021-09-27 11:58 ` Dmitry Gutov 0 siblings, 1 reply; 21+ messages in thread From: Stefan Kangas @ 2021-09-27 11:10 UTC (permalink / raw) To: João Távora, emacs-devel; +Cc: Adam Porter joaotavora@gmail.com (João Távora) writes: > +(defun t-reverse-lines (s) (string-join (reverse (sns-lines s)) "\n") > + > +;; Local Variables: > +;; elisp-shorthands: (("t-" . "my-tricks-") > +;; ("sns-" . "some-nice-string-utils-")) > +;; End: This is really nice and straight-forward, thanks! I see one problem here. It basically splits the require up in two: I need to look both at the start and at the end of the file to understand what is going on. In the previous discussion, Adam Porter suggested this:[1] (shorthand-require 'magnar-string :with "^s-" :as "magnar-string-") I like that proposal a lot, but it's a bit too verbose for my taste. It also seems to flip the :as and :with from what I would expect (in Python, "import x as y" means that x is available "as" y in this file). In my ideal world, we should be able to just say simply: (require 'magnar-string :as "s-") There could be a variable inside magnar-string.el that gives us the rest, e.g.: elisp-default-import-prefix: "^magnar-string-" WDYT? Footnotes: [1] https://lists.gnu.org/r/emacs-devel/2020-05/msg01754.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Better way to require with shorthands/renamed symbols 2021-09-27 11:10 ` Better way to require with shorthands/renamed symbols Stefan Kangas @ 2021-09-27 11:58 ` Dmitry Gutov 2021-09-27 12:54 ` Shorthands have landed on master (Was: Better way to require with shorthands/renamed symbols) João Távora 0 siblings, 1 reply; 21+ messages in thread From: Dmitry Gutov @ 2021-09-27 11:58 UTC (permalink / raw) To: Stefan Kangas, João Távora, emacs-devel; +Cc: Adam Porter On 27.09.2021 14:10, Stefan Kangas wrote: > In my ideal world, we should be able to just say simply: > > (require 'magnar-string :as "s-") This would be much nicer, yes. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Shorthands have landed on master (Was: Better way to require with shorthands/renamed symbols) 2021-09-27 11:58 ` Dmitry Gutov @ 2021-09-27 12:54 ` João Távora 2021-09-27 22:40 ` Shorthands have landed on master Philip Kaludercic 0 siblings, 1 reply; 21+ messages in thread From: João Távora @ 2021-09-27 12:54 UTC (permalink / raw) To: Dmitry Gutov; +Cc: Adam Porter, Stefan Kangas, emacs-devel [-- Attachment #1: Type: text/plain, Size: 213 bytes --] Hello all. Anyway, as you may have noticed, "Shorthands" have landed on master. Please check out the NEWS entry and the manual section on "Shorthands". For the impatient, I leave with with a tiny animated gif. [-- Attachment #2: shorthand-demo.gif --] [-- Type: image/gif, Size: 846811 bytes --] [-- Attachment #3: Type: text/plain, Size: 560 bytes --] Dmitry Gutov <dgutov@yandex.ru> writes: > On 27.09.2021 14:10, Stefan Kangas wrote: >> In my ideal world, we sho uld be able to just say simply: >> (require 'magnar-string :as "s-") > This would be much nicer, yes. Unfortunately, that comes with many other implications that you may or may not be seeing. I've replied to Stefan in detail. Anyway, I hope people can briefly try out the feature as it is now, and report any bugs, slightly delaying their "much nicer" suggestion (which are more than expected and very welcome). João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-27 12:54 ` Shorthands have landed on master (Was: Better way to require with shorthands/renamed symbols) João Távora @ 2021-09-27 22:40 ` Philip Kaludercic 2021-09-27 22:58 ` João Távora 0 siblings, 1 reply; 21+ messages in thread From: Philip Kaludercic @ 2021-09-27 22:40 UTC (permalink / raw) To: João Távora Cc: Adam Porter, emacs-devel, Stefan Kangas, Dmitry Gutov João Távora <joaotavora@gmail.com> writes: > Hello all. > > Anyway, as you may have noticed, "Shorthands" have landed on master. > Please check out the NEWS entry and the manual section on "Shorthands". > > For the impatient, I leave with with a tiny animated gif. From what I see, elisp-shorthands only allows a shorter prefix to be mapped to a longer prefix, right? So this doesn't allow me to use cl-lib without the cl- prefix, or remove the compat-- prefix from compatibility functions? -- Philip Kaludercic ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-27 22:40 ` Shorthands have landed on master Philip Kaludercic @ 2021-09-27 22:58 ` João Távora 2021-09-28 7:15 ` Philip Kaludercic 0 siblings, 1 reply; 21+ messages in thread From: João Távora @ 2021-09-27 22:58 UTC (permalink / raw) To: Philip Kaludercic; +Cc: Adam Porter, emacs-devel, Stefan Kangas, Dmitry Gutov On Mon, Sep 27, 2021 at 11:40 PM Philip Kaludercic <philipk@posteo.net> wrote: > > João Távora <joaotavora@gmail.com> writes: > > > Hello all. > > > > Anyway, as you may have noticed, "Shorthands" have landed on master. > > Please check out the NEWS entry and the manual section on "Shorthands". > > > > For the impatient, I leave with with a tiny animated gif. > > From what I see, elisp-shorthands only allows a shorter prefix to be > mapped to a longer prefix, right? So this doesn't allow me to use cl-lib > without the cl- prefix, You need to have _some_ prefix. It cannot be of 0 length. Best you can do is '-loop' and '-destructuring-bind', for example. In fact, I lie. You _can_ map 'loop' to 'cl-loop' explicitly. 'loop' is the shorthand. 'cl-loop' is still the symbol. But you have to do it symbol by symbol. That's because I've purposely turned off "freer" renamings in favor of prefixes, simplicity and read speed. But they are not impossible. > or remove the compat-- prefix from compatibility > functions? It's too late in the day for me to understand what you mean by "remove" here :-) You must first understand what shorthands are: they are merely file-local aliases to symbols which keep their full names. Does this help in answering your question? If it doesn't, provide a toy example with files and code in it, and illustrate clearly what you would like to be able to write, but can't (right now) Then maybe I can say if shorthands can help you. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-27 22:58 ` João Távora @ 2021-09-28 7:15 ` Philip Kaludercic 2021-09-28 9:03 ` João Távora 0 siblings, 1 reply; 21+ messages in thread From: Philip Kaludercic @ 2021-09-28 7:15 UTC (permalink / raw) To: João Távora Cc: Adam Porter, Dmitry Gutov, Stefan Kangas, emacs-devel João Távora <joaotavora@gmail.com> writes: > On Mon, Sep 27, 2021 at 11:40 PM Philip Kaludercic <philipk@posteo.net> wrote: >> >> João Távora <joaotavora@gmail.com> writes: >> >> > Hello all. >> > >> > Anyway, as you may have noticed, "Shorthands" have landed on master. >> > Please check out the NEWS entry and the manual section on "Shorthands". >> > >> > For the impatient, I leave with with a tiny animated gif. >> >> From what I see, elisp-shorthands only allows a shorter prefix to be >> mapped to a longer prefix, right? So this doesn't allow me to use cl-lib >> without the cl- prefix, > > You need to have _some_ prefix. It cannot be of 0 length. Best > you can do is '-loop' and '-destructuring-bind', for example. > > In fact, I lie. You _can_ map 'loop' to 'cl-loop' explicitly. > 'loop' is the shorthand. 'cl-loop' is still the symbol. > But you have to do it symbol by symbol. > > That's because I've purposely turned off "freer" renamings in > favor of prefixes, simplicity and read speed. But they are > not impossible. I see. Do you think it would make sense to use predefined shorthand groups, in case someone *would* want to use cl-lib without the prefix? >> or remove the compat-- prefix from compatibility >> functions? > > It's too late in the day for me to understand what you mean by > "remove" here :-) You must first understand what shorthands are: > they are merely file-local aliases to symbols which keep their > full names. This was in reference to the compat.el discussion from a few days ago. It was mentioned that shorthands might provide an alternative to aliasing function definitions. But this doesn't make much sense, if a prefix has to be used, short or long: I want to call (macroexp-file-name), not (co-macroexp-file-name), (~macroexp-file-name) or (compat--macroexp-file-name) to provide transparent compatibility. > Does this help in answering your question? After trying out ;; elisp-shorthands: (("" . "cl-")) I saw what went wrong and I understand why. On that topic, I think the behaviour was inadequate, because a lot of unrelated commands also broke that might become annoying. > If it doesn't, provide a toy example with files and code in it, > and illustrate clearly what you would like to be able to write, > but can't (right now) Then maybe I can say if shorthands can > help you. > > João > > -- Philip Kaludercic ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-28 7:15 ` Philip Kaludercic @ 2021-09-28 9:03 ` João Távora 2021-09-28 9:14 ` Eli Zaretskii 2021-09-28 9:22 ` Philip Kaludercic 0 siblings, 2 replies; 21+ messages in thread From: João Távora @ 2021-09-28 9:03 UTC (permalink / raw) To: Philip Kaludercic; +Cc: Adam Porter, Dmitry Gutov, Stefan Kangas, emacs-devel On Tue, Sep 28, 2021 at 8:15 AM Philip Kaludercic <philipk@posteo.net> wrote: > > João Távora <joaotavora@gmail.com> writes: > > > On Mon, Sep 27, 2021 at 11:40 PM Philip Kaludercic <philipk@posteo.net> wrote: > I see. Do you think it would make sense to use predefined shorthand > groups, in case someone *would* want to use cl-lib without the prefix? Yes, I do think that makes sense. ...meaning that drawbacks aren't immediately visible to me right now :-) Since elisp-shorthands is a file-local variable, I think it allows (eval) specs. Perhaps you can try with that, for now? I don't think it'd be hard to add better support for such predefined groups of shorthands. > This was in reference to the compat.el discussion from a few days > ago. It was mentioned that shorthands might provide an alternative to > aliasing function definitions. But this doesn't make much sense, if a > prefix has to be used, short or long: I want to call > (macroexp-file-name), not (co-macroexp-file-name), (~macroexp-file-name) > or (compat--macroexp-file-name) to provide transparent compatibility. If I understand this right, then I think you may solve it similarly to the cl- situation. But you understand that, for the moment, shorthands are only supported in Emacs 28, right? Not sure where (in which versions) the library you're intending to write would be loaded. If that library is loaded in Emacs 27, elisp-shorthands is simply ignored and the file is loaded normally. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-28 9:03 ` João Távora @ 2021-09-28 9:14 ` Eli Zaretskii 2021-09-28 9:17 ` João Távora 2021-09-28 9:22 ` Philip Kaludercic 1 sibling, 1 reply; 21+ messages in thread From: Eli Zaretskii @ 2021-09-28 9:14 UTC (permalink / raw) To: João Távora; +Cc: adam, philipk, emacs-devel, stefankangas, dgutov > From: João Távora <joaotavora@gmail.com> > Date: Tue, 28 Sep 2021 10:03:01 +0100 > Cc: Adam Porter <adam@alphapapa.net>, Dmitry Gutov <dgutov@yandex.ru>, > Stefan Kangas <stefankangas@gmail.com>, emacs-devel <emacs-devel@gnu.org> > > Since elisp-shorthands is a file-local variable, I think it allows (eval) > specs. But that will be unsafe, no? ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-28 9:14 ` Eli Zaretskii @ 2021-09-28 9:17 ` João Távora 0 siblings, 0 replies; 21+ messages in thread From: João Távora @ 2021-09-28 9:17 UTC (permalink / raw) To: Eli Zaretskii Cc: Adam Porter, Philip K., emacs-devel, Stefan Kangas, Dmitry Gutov On Tue, Sep 28, 2021 at 10:14 AM Eli Zaretskii <eliz@gnu.org> wrote: > > > From: João Távora <joaotavora@gmail.com> > > Date: Tue, 28 Sep 2021 10:03:01 +0100 > > Cc: Adam Porter <adam@alphapapa.net>, Dmitry Gutov <dgutov@yandex.ru>, > > Stefan Kangas <stefankangas@gmail.com>, emacs-devel <emacs-devel@gnu.org> > > > > Since elisp-shorthands is a file-local variable, I think it allows (eval) > > specs. > > But that will be unsafe, no? Yes, this is why I wrote "for now". It does seem plausible that Emacs provides pre-canned alists of substitutions such as the one used for reading 'loop' as 'cl-loop', 'second' as 'cl-second', and so on. Those would be "safe" AFAIK and we could have a mechanism to mark them so. João ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Shorthands have landed on master 2021-09-28 9:03 ` João Távora 2021-09-28 9:14 ` Eli Zaretskii @ 2021-09-28 9:22 ` Philip Kaludercic 1 sibling, 0 replies; 21+ messages in thread From: Philip Kaludercic @ 2021-09-28 9:22 UTC (permalink / raw) To: João Távora Cc: Adam Porter, Dmitry Gutov, Stefan Kangas, emacs-devel João Távora <joaotavora@gmail.com> writes: >> This was in reference to the compat.el discussion from a few days >> ago. It was mentioned that shorthands might provide an alternative to >> aliasing function definitions. But this doesn't make much sense, if a >> prefix has to be used, short or long: I want to call >> (macroexp-file-name), not (co-macroexp-file-name), (~macroexp-file-name) >> or (compat--macroexp-file-name) to provide transparent compatibility. > > If I understand this right, then I think you may solve it similarly to the > cl- situation. > > But you understand that, for the moment, shorthands are only supported in > Emacs 28, right? Not sure where (in which versions) the library you're > intending to write would be loaded. If that library is loaded in Emacs 27, > elisp-shorthands is simply ignored and the file is loaded normally. Yes, my idea was to use shorthands for versions greater or equal to 28.1. > João -- Philip Kaludercic ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2021-10-02 23:19 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-09-29 23:58 Shorthands have landed on master No Wayman 2021-09-30 2:43 ` Bodertz 2021-09-30 4:26 ` Michael Heerdegen 2021-09-30 22:08 ` Richard Stallman 2021-09-30 22:11 ` João Távora 2021-10-01 3:04 ` Stefan Monnier 2021-10-01 6:01 ` João Távora 2021-10-01 6:34 ` Thierry Volpiatto 2021-10-02 23:18 ` Richard Stallman 2021-10-02 23:19 ` João Távora 2021-10-01 22:38 ` Richard Stallman 2021-10-01 22:45 ` João Távora 2021-10-02 6:15 ` Eli Zaretskii 2021-10-02 6:50 ` João Távora [not found] <20210927003203.15806.29864@vcs0.savannah.gnu.org> [not found] ` <20210927003205.EF26620A5E@vcs0.savannah.gnu.org> 2021-09-27 11:10 ` Better way to require with shorthands/renamed symbols Stefan Kangas 2021-09-27 11:58 ` Dmitry Gutov 2021-09-27 12:54 ` Shorthands have landed on master (Was: Better way to require with shorthands/renamed symbols) João Távora 2021-09-27 22:40 ` Shorthands have landed on master Philip Kaludercic 2021-09-27 22:58 ` João Távora 2021-09-28 7:15 ` Philip Kaludercic 2021-09-28 9:03 ` João Távora 2021-09-28 9:14 ` Eli Zaretskii 2021-09-28 9:17 ` João Távora 2021-09-28 9:22 ` Philip Kaludercic
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.