* Special Event: Davin reveals his own personal additions to Emacs.
@ 2022-07-10 3:39 Davin Pearson
2022-07-10 8:56 ` Philip Kaludercic
` (3 more replies)
0 siblings, 4 replies; 20+ messages in thread
From: Davin Pearson @ 2022-07-10 3:39 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
Click on the following link to take you to a gallery of Emacs
screenshots showing the hows and whys I have added my own personal
additions to Emacs.
http://davinpearson.nz/screenshots
The most important and probably the most useful customisation that I
have is a drop in replacement for M-y. Instead of cycling through the
kill ring, it brings up a window showing the kill ring in the order of
the kill ring. You then click on the ENTER button of paste from the
kill ring to the last buffer you were editing.
In all my code I use the practice of prefixing all of my functions and
variables with <tt>dmp</tt> where DMP stands for Davin Max Pearson
which is my name. I am unsure of just how useful this practice is for
adding to the Emacs sources.
[-- Attachment #2: Type: text/html, Size: 903 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 3:39 Special Event: Davin reveals his own personal additions to Emacs Davin Pearson
@ 2022-07-10 8:56 ` Philip Kaludercic
2022-07-12 23:20 ` Davin Pearson
2022-07-10 11:45 ` Jean Louis
` (2 subsequent siblings)
3 siblings, 1 reply; 20+ messages in thread
From: Philip Kaludercic @ 2022-07-10 8:56 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
Davin Pearson <davin.pearson@gmail.com> writes:
> The most important and probably the most useful customisation that I
> have is a drop in replacement for M-y. Instead of cycling through the
> kill ring, it brings up a window showing the kill ring in the order of
> the kill ring. You then click on the ENTER button of paste from the
> kill ring to the last buffer you were editing.
Since Emacs 28.1 this is done too (unless the last command was `yank'),
just that the selection is made using `completing-read'
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 3:39 Special Event: Davin reveals his own personal additions to Emacs Davin Pearson
2022-07-10 8:56 ` Philip Kaludercic
@ 2022-07-10 11:45 ` Jean Louis
2022-07-12 22:35 ` Davin Pearson
2022-07-10 12:57 ` Stefan Monnier
2022-07-17 1:43 ` Davin Pearson
3 siblings, 1 reply; 20+ messages in thread
From: Jean Louis @ 2022-07-10 11:45 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
* Davin Pearson <davin.pearson@gmail.com> [2022-07-10 06:39]:
> Click on the following link to take you to a gallery of Emacs
> screenshots showing the hows and whys I have added my own personal
> additions to Emacs.
>
> http://davinpearson.nz/screenshots
Thanks David, those may be useful features for Emacs.
I suggest that you read Emacs Lisp Manual and try understanding how to
make an Emacs package. This is because you have got many features and
other languages combined in package software package. It is better
separating it.
You may evaluate this below:
(info "(elisp) Packaging")
When you start writing Emacs file you better set it up as proper
package that may be installed with M-x package-install-file or M-x
package-install-from-buffer
I may recommend my package to help with it:
Emacs: `package-header.el` your hjälpsam Package Header Assistant:
https://hyperscope.link/3/7/7/3/0/Your-hjälpsam-Package-Header-Assistant-37730.html
I do understand that you maybe use m4 to insert those package header
snippets.
In general you do follow the guidelines. Let us say "yes.el", it
misses `provide' on the end, and M-x package-install-from-buffer fails
due to missing headers. Do you really want global scoping there?
File: xyzdmp-reddy.el contains just "sdfsdsdf", is that wanted?
Instead of trying to update all files, I think you should have them
separated by their functionality and make separate packages.
Once packages are ready feel free to send them to this mailing list
for possible inclusion in ELPA. What do you think about it?
Naming issues:
==============
Please note that while it is possible, you should rather name your
modes like `css-mode` to be something else than those already well
common functions in main Emacs. For example, as you said, you could
name it `dmp-css-mode` as your function would overwrite the already
existing `css-mode'in Emacs.
Coding or style issues:
=======================
I do not recommend `progn` standing alone in packages, seetting
load-path and requiring `dotmacs. It is better you prepare package
header properly, that will make your dependencies clear.
`defun` shall placed always after one empty line.
You should not execute programs in packages or files, rather let user
invoke its functions by their will.
Do not hard code paths, like:
"c:/sound-samples/emacs/appt-pause-break.wav" but you should include
such files in the package.tar.gz, read instructions how to do that.
Parenthesis shall end together, not like this:
(defun manifest--log-message (msg)
(save-excursion
(set-buffer manifest--buffer)
(goto-char (point-max))
(setq latest-file (manifest--get-latest-file))
(insert msg "\n")
)
)
rather like:
(defun manifest--log-message (msg)
(save-excursion
(set-buffer manifest--buffer)
(goto-char (point-max))
(setq latest-file (manifest--get-latest-file))
(insert msg "\n")))
`defun' shall rather have its docstring or descriptions.
And other issues. I am sure you may find useful functions for other
users to be published in your new packages.
Installation issues:
====================
You have made Makefile that will probably work on your system only. I
have not tried it, as I am afraid of my file system being changed
capriciously.
Licensing issues:
==================
Emacs is licensed under GPL version 3 and later, thus all Emacs
packages that modify Emacs as whole program shall be published shall
be published under compatible license.
In the package bundle I found only "Copyright (C) 2014-2015 Davin
Pearson" as in the file dmp-css.el.
And I know you are generating compatible licenses, however, one cannot
just easily draw such conclusion without knowing that you could maybe
do that with m4, it means, at first sight, some users would or could
give up in getting packages.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 3:39 Special Event: Davin reveals his own personal additions to Emacs Davin Pearson
2022-07-10 8:56 ` Philip Kaludercic
2022-07-10 11:45 ` Jean Louis
@ 2022-07-10 12:57 ` Stefan Monnier
2022-07-10 16:03 ` Document that symbol prefix "my-" (or other) should be left for users Teemu Likonen
2022-07-10 18:22 ` Special Event: Davin reveals his own personal additions to Emacs Clément Pit-Claudel
2022-07-17 1:43 ` Davin Pearson
3 siblings, 2 replies; 20+ messages in thread
From: Stefan Monnier @ 2022-07-10 12:57 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> In all my code I use the practice of prefixing all of my functions and
> variables with <tt>dmp</tt> where DMP stands for Davin Max Pearson
> which is my name.
I think it's a fairly common practice. I tend to use `my-` for that
purpose, hoping that there's a chance we can avoid having someone write
a package that uses this `my-` prefix, whereas it seems unlikely that
noone will ever write a package that uses a prefix which conflicts
with someone's initials.
Maybe we should officially declare the `my-` prefix as reserved for the
end-user.
> I am unsure of just how useful this practice is for adding to the
> Emacs sources.
When distributing code for other people to use, such a "personal prefix"
should be replaced with something else, indeed.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Document that symbol prefix "my-" (or other) should be left for users
2022-07-10 12:57 ` Stefan Monnier
@ 2022-07-10 16:03 ` Teemu Likonen
2022-07-10 16:59 ` Stefan Kangas
2022-07-10 18:22 ` Special Event: Davin reveals his own personal additions to Emacs Clément Pit-Claudel
1 sibling, 1 reply; 20+ messages in thread
From: Teemu Likonen @ 2022-07-10 16:03 UTC (permalink / raw)
To: Stefan Monnier, Davin Pearson; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 501 bytes --]
* 2022-07-10 08:57:16-0400, Stefan Monnier wrote:
> Maybe we should officially declare the `my-` prefix as reserved for the
> end-user.
I support that and proposed it already in 2015-12-13:
<https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00556.html>.
There is an example documentation patch in the message but some people
opposed the idea and nothing happened.
--
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Document that symbol prefix "my-" (or other) should be left for users
2022-07-10 16:03 ` Document that symbol prefix "my-" (or other) should be left for users Teemu Likonen
@ 2022-07-10 16:59 ` Stefan Kangas
2022-07-10 18:11 ` Bozhidar Batsov
0 siblings, 1 reply; 20+ messages in thread
From: Stefan Kangas @ 2022-07-10 16:59 UTC (permalink / raw)
To: Teemu Likonen, Stefan Monnier, Davin Pearson; +Cc: emacs-devel
Teemu Likonen <tlikonen@iki.fi> writes:
> I support that and proposed it already in 2015-12-13:
> <https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00556.html>.
>
> There is an example documentation patch in the message but some people
> opposed the idea and nothing happened.
I tend to agree with John Wiegley here, when he says that it doesn't
really need explicit documentation:
https://lists.gnu.org/r/emacs-devel/2015-12/msg00608.html
It just seems to be more words added to the ELisp manual for little
benefit.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Document that symbol prefix "my-" (or other) should be left for users
2022-07-10 16:59 ` Stefan Kangas
@ 2022-07-10 18:11 ` Bozhidar Batsov
2022-07-10 19:20 ` Tim Cross
0 siblings, 1 reply; 20+ messages in thread
From: Bozhidar Batsov @ 2022-07-10 18:11 UTC (permalink / raw)
To: Emacs Devel
[-- Attachment #1: Type: text/plain, Size: 755 bytes --]
Agreed. Not to mention this prefix is not super common - a ton of people user their name, initials, etc. E.g. `boz-my-command`.
On Sun, Jul 10, 2022, at 7:59 PM, Stefan Kangas wrote:
> Teemu Likonen <tlikonen@iki.fi> writes:
>
> > I support that and proposed it already in 2015-12-13:
> > <https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg00556.html>.
> >
> > There is an example documentation patch in the message but some people
> > opposed the idea and nothing happened.
>
> I tend to agree with John Wiegley here, when he says that it doesn't
> really need explicit documentation:
>
> https://lists.gnu.org/r/emacs-devel/2015-12/msg00608.html
>
> It just seems to be more words added to the ELisp manual for little
> benefit.
>
>
[-- Attachment #2: Type: text/html, Size: 1445 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 12:57 ` Stefan Monnier
2022-07-10 16:03 ` Document that symbol prefix "my-" (or other) should be left for users Teemu Likonen
@ 2022-07-10 18:22 ` Clément Pit-Claudel
2022-07-10 19:50 ` Rudolf Adamkovič
1 sibling, 1 reply; 20+ messages in thread
From: Clément Pit-Claudel @ 2022-07-10 18:22 UTC (permalink / raw)
To: emacs-devel
On 7/10/22 05:57, Stefan Monnier wrote:
> I think it's a fairly common practice. I tend to use `my-` for that
> purpose, hoping that there's a chance we can avoid having someone write
> a package that uses this `my-` prefix, whereas it seems unlikely that
> noone will ever write a package that uses a prefix which conflicts
> with someone's initials.
>
> Maybe we should officially declare the `my-` prefix as reserved for the
> end-user.
I use ~/ (as in `~/kill-this-buffer', for example), since they are my "home" functions.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Document that symbol prefix "my-" (or other) should be left for users
2022-07-10 18:11 ` Bozhidar Batsov
@ 2022-07-10 19:20 ` Tim Cross
2022-07-11 3:17 ` Richard Stallman
0 siblings, 1 reply; 20+ messages in thread
From: Tim Cross @ 2022-07-10 19:20 UTC (permalink / raw)
To: Bozhidar Batsov; +Cc: emacs-devel
"Bozhidar Batsov" <bozhidar@batsov.dev> writes:
> Agreed. Not to mention this prefix is not super common - a ton of people user their name, initials, etc. E.g. `boz-my-command`.
>
Yep, I have used my-command and often tx-command (for my initials x =
cross and yes, not great due to tx/rx being often used for send/receive,
though never been an issue so far).
The other 'convention' I see is my/command or my~command. I do find my/
or tx/ appealing, although I haven't 'switched' to use it.
One possible 'nice' advantage of my- would be that if it was flagged as
a 'personal' or reserved prefix, borrowing customisations and
bits of code from others would potentially be easier to add (but I guess
perhaps that is not necessarily a good thing!).
I'd love to have real namespace support in elisp. Something like Cl
packages or even better, something like Clojure where you can require a
package and specify either a prefix alias used to access symbols from
the package/namespace or a list of 'refer' symbols which can be accessed
without prefix. Anything which could help enable the use of shorter
symbol names and eliminate the need to use prefixes to avoid name
collision would be great.
Of course, on the other hand, with the exception of longer names, in
over 25 years of Emacs use and especially since the growth in elisp
packages, name collision is something I rarely run into, so the current
status quo does at least seem to work and completion mechanisms have
evolved to make completing with large numbers of candidates having the
same prefix work well and you do tend to get use to the name 'noise'.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 18:22 ` Special Event: Davin reveals his own personal additions to Emacs Clément Pit-Claudel
@ 2022-07-10 19:50 ` Rudolf Adamkovič
0 siblings, 0 replies; 20+ messages in thread
From: Rudolf Adamkovič @ 2022-07-10 19:50 UTC (permalink / raw)
To: Clément Pit-Claudel, emacs-devel
Clément Pit-Claudel <cpitclaudel@gmail.com> writes:
> I use ~/ (as in `~/kill-this-buffer', for example), since they are my
> "home" functions.
I used to use "my-" and "my/" but never liked the misalignment in M-x
and everywhere else. It almost felt as if extending Emacs was not
something common.
Now, I append "+" to the function name, and I cannot get enough of its
beauty. The plus denotes "added" by the user. Examples:
magit-commit-mail-and-news+
org-remove-all-links+
(If we had a standard way to extend Emacs, we could not just provide
certain guarantees to the user [at least per convention] but also some
UI affordances, such as highlighted trailing "+" in M-x and such.)
Rudy
--
"I love deadlines. I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt, 2002
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Document that symbol prefix "my-" (or other) should be left for users
2022-07-10 19:20 ` Tim Cross
@ 2022-07-11 3:17 ` Richard Stallman
0 siblings, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2022-07-11 3:17 UTC (permalink / raw)
To: Tim Cross; +Cc: bozhidar, 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. ]]]
> I'd love to have real namespace support in elisp.
The symbol-aliasing feature was supposed to give us that, but a little
more work is needed. Would anyone like to finish this?
--
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] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 11:45 ` Jean Louis
@ 2022-07-12 22:35 ` Davin Pearson
2022-07-13 3:08 ` Stefan Monnier
0 siblings, 1 reply; 20+ messages in thread
From: Davin Pearson @ 2022-07-12 22:35 UTC (permalink / raw)
To: Davin Pearson, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 4736 bytes --]
On Sun, 10 Jul 2022 at 23:46, Jean Louis <bugs@gnu.support> wrote:
> * Davin Pearson <davin.pearson@gmail.com> [2022-07-10 06:39]:
> > Click on the following link to take you to a gallery of Emacs
> > screenshots showing the hows and whys I have added my own personal
> > additions to Emacs.
> >
> > http://davinpearson.nz/screenshots
>
> Thanks David, those may be useful features for Emacs.
>
My name is Davin not David. I get this all the time.
> I suggest that you read Emacs Lisp Manual and try understanding how to
> make an Emacs package. This is because you have got many features and
> other languages combined in package software package. It is better
> separating it.
>
> You may evaluate this below:
>
> (info "(elisp) Packaging")
>
> When you start writing Emacs file you better set it up as proper
> package that may be installed with M-x package-install-file or M-x
> package-install-from-buffer
>
> I may recommend my package to help with it:
>
> Emacs: `package-header.el` your hjälpsam Package Header Assistant:
>
> https://hyperscope.link/3/7/7/3/0/Your-hjälpsam-Package-Header-Assistant-37730.html
>
> I do understand that you maybe use m4 to insert those package header
> snippets.
>
> In general you do follow the guidelines. Let us say "yes.el", it
> misses `provide' on the end, and M-x package-install-from-buffer fails
> due to missing headers. Do you really want global scoping there?
>
> File: xyzdmp-reddy.el contains just "sdfsdsdf", is that wanted?
>
The purpose of this file is a verify that the syntax-highlighting works.
> Instead of trying to update all files, I think you should have them
> separated by their functionality and make separate packages.
>
> Once packages are ready feel free to send them to this mailing list
> for possible inclusion in ELPA. What do you think about it?
>
>
> Naming issues:
> ==============
>
> Please note that while it is possible, you should rather name your
> modes like `css-mode` to be something else than those already well
> common functions in main Emacs. For example, as you said, you could
> name it `dmp-css-mode` as your function would overwrite the already
> existing `css-mode'in Emacs.
>
>
> Coding or style issues:
> =======================
>
> I do not recommend `progn` standing alone in packages, seetting
> load-path and requiring `dotmacs. It is better you prepare package
> header properly, that will make your dependencies clear.
>
> `defun` shall placed always after one empty line.
>
ok I've got you on this point.
>
> You should not execute programs in packages or files, rather let user
> invoke its functions by their will.
>
> Do not hard code paths, like:
> "c:/sound-samples/emacs/appt-pause-break.wav" but you should include
> such files in the package.tar.gz, read instructions how to do that.
>
> thank you
> Parenthesis shall end together, not like this:
>
> (defun manifest--log-message (msg)
> (save-excursion
> (set-buffer manifest--buffer)
> (goto-char (point-max))
> (setq latest-file (manifest--get-latest-file))
> (insert msg "\n")
> )
> )
>
> rather like:
>
> (defun manifest--log-message (msg)
> (save-excursion
> (set-buffer manifest--buffer)
> (goto-char (point-max))
> (setq latest-file (manifest--get-latest-file))
> (insert msg "\n")))
>
I prefer my own way of doing things, but I might have
a solution that patches the files automatically before
uploading them.
> `defun' shall rather have its docstring or descriptions.
>
> And other issues. I am sure you may find useful functions for other
> users to be published in your new packages.
>
>
> Installation issues:
> ====================
>
> You have made Makefile that will probably work on your system only. I
> have not tried it, as I am afraid of my file system being changed
> capriciously.
>
>
> Licensing issues:
> ==================
>
> Emacs is licensed under GPL version 3 and later, thus all Emacs
> packages that modify Emacs as whole program shall be published shall
> be published under compatible license.
>
> In the package bundle I found only "Copyright (C) 2014-2015 Davin
> Pearson" as in the file dmp-css.el.
>
> And I know you are generating compatible licenses, however, one cannot
> just easily draw such conclusion without knowing that you could maybe
> do that with m4, it means, at first sight, some users would or could
> give up in getting packages.
>
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>
[-- Attachment #2: Type: text/html, Size: 6681 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 8:56 ` Philip Kaludercic
@ 2022-07-12 23:20 ` Davin Pearson
0 siblings, 0 replies; 20+ messages in thread
From: Davin Pearson @ 2022-07-12 23:20 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 677 bytes --]
On Sun, 10 Jul 2022 at 20:56, Philip Kaludercic <philipk@posteo.net> wrote:
> Davin Pearson <davin.pearson@gmail.com> writes:
>
> > The most important and probably the most useful customisation that I
> > have is a drop in replacement for M-y. Instead of cycling through the
> > kill ring, it brings up a window showing the kill ring in the order of
> > the kill ring. You then click on the ENTER button of paste from the
> > kill ring to the last buffer you were editing.
>
> Since Emacs 28.1 this is done too (unless the last command was `yank'),
> just that the selection is made using `completing-read'
>
Are you saying that my feature has already been added to Emacs?
[-- Attachment #2: Type: text/html, Size: 1129 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-12 22:35 ` Davin Pearson
@ 2022-07-13 3:08 ` Stefan Monnier
2022-07-13 22:57 ` Davin Pearson
0 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2022-07-13 3:08 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
>> Parenthesis shall end together, not like this:
>>
>> (defun manifest--log-message (msg)
>> (save-excursion
>> (set-buffer manifest--buffer)
>> (goto-char (point-max))
>> (setq latest-file (manifest--get-latest-file))
>> (insert msg "\n")
>> )
>> )
>>
>> rather like:
>>
>> (defun manifest--log-message (msg)
>> (save-excursion
>> (set-buffer manifest--buffer)
>> (goto-char (point-max))
>> (setq latest-file (manifest--get-latest-file))
>> (insert msg "\n")))
I dislike those close-parens-on-their-own-lines as well, but more
importantly:
- should use `with-current-buffer`.
- should not `setq` on a global variable that doesn't have an appropriate
namespace prefix.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-13 3:08 ` Stefan Monnier
@ 2022-07-13 22:57 ` Davin Pearson
2022-07-14 1:47 ` Stefan Monnier
0 siblings, 1 reply; 20+ messages in thread
From: Davin Pearson @ 2022-07-13 22:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]
On Wed, 13 Jul 2022 at 15:08, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> >> Parenthesis shall end together, not like this:
> >>
> >> (defun manifest--log-message (msg)
> >> (save-excursion
> >> (set-buffer manifest--buffer)
> >> (goto-char (point-max))
> >> (setq latest-file (manifest--get-latest-file))
> >> (insert msg "\n")
> >> )
> >> )
> >>
> >> rather like:
> >>
> >> (defun manifest--log-message (msg)
> >> (save-excursion
> >> (set-buffer manifest--buffer)
> >> (goto-char (point-max))
> >> (setq latest-file (manifest--get-latest-file))
> >> (insert msg "\n")))
>
> I dislike those close-parens-on-their-own-lines as well,
I use debugging checkpoints every second line
so the following code cannot be written:
(defun foo ()
(progn
(progn
(zip)
(message "&apple:1")
(zap)
(message "&apple:2")
(boo)
(message "&apple:3")
(bum)
(message "&apple:4"))))
Because the line (message &apple:4")))) will be deleted
using some code that comments out all debugging checkpoints.
Now that I think of it, I think I could get my code to behave
sensibly in this case... It just adds 1 more layer of intelligence
that I need to write.
> but more
> importantly:
> - should use `with-current-buffer`.
>
is that instead of (set-buffer buf)?
> - should not `setq` on a global variable that doesn't have an appropriate
> namespace prefix.
>
Do you mean the following is not allowed:
(setq apple 'banana)
but the following code is allowed:
(setq dmp-apple 'banana)
Thanks for your valuable time in helping
to make my code more standards compliant.
[-- Attachment #2: Type: text/html, Size: 3093 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-13 22:57 ` Davin Pearson
@ 2022-07-14 1:47 ` Stefan Monnier
2022-07-14 2:30 ` Davin Pearson
0 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2022-07-14 1:47 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> I use debugging checkpoints every second line
> so the following code cannot be written:
>
> (defun foo ()
> (progn
> (progn
> (zip)
> (message "&apple:1")
> (zap)
> (message "&apple:2")
> (boo)
> (message "&apple:3")
> (bum)
> (message "&apple:4"))))
I do use separate lines for closing parens every once in a while, don't
get me wrong. It's just an exception rather than a rule.
[ Note also that inserting/removing such `message` needs to be different
for the last element in any case because it determines the return
value. ]
>> importantly:
>> - should use `with-current-buffer`.
>
> is that instead of (set-buffer buf)?
If you compile the code, the byte-compiler will give you a warning
suggesting to replace with-current-buffer for save-excursion + set-buffer.
>> - should not `setq` on a global variable that doesn't have an appropriate
>> namespace prefix.
>>
> Do you mean the following is not allowed:
>
> (setq apple 'banana)
>
> but the following code is allowed:
>
> (setq dmp-apple 'banana)
Neither are recommended without first declaring that global variable
(since that's what it is: a global variable).
And global declarations need to use a proper namespace prefix.
Otherwise you're at risk of stepping on someone else's toes/variables.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-14 1:47 ` Stefan Monnier
@ 2022-07-14 2:30 ` Davin Pearson
2022-07-14 4:42 ` Davin Pearson
2022-07-14 14:13 ` Stefan Monnier
0 siblings, 2 replies; 20+ messages in thread
From: Davin Pearson @ 2022-07-14 2:30 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]
Is dmp a reasonable prefix for global variables?
I once used my-* for my global variables but abandoned it
when other people started to use my code.
It is rather unlikely that there is a dmp out there in the world today.
Lisp namespaces should be allocated on a first in first served basis,
which is how internet domain names are allocated.
On Thu, 14 Jul 2022 at 13:48, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> > I use debugging checkpoints every second line
> > so the following code cannot be written:
> >
> > (defun foo ()
> > (progn
> > (progn
> > (zip)
> > (message "&apple:1")
> > (zap)
> > (message "&apple:2")
> > (boo)
> > (message "&apple:3")
> > (bum)
> > (message "&apple:4"))))
>
> I do use separate lines for closing parens every once in a while, don't
> get me wrong. It's just an exception rather than a rule.
> [ Note also that inserting/removing such `message` needs to be different
> for the last element in any case because it determines the return
> value. ]
>
> >> importantly:
> >> - should use `with-current-buffer`.
> >
> > is that instead of (set-buffer buf)?
>
> If you compile the code, the byte-compiler will give you a warning
> suggesting to replace with-current-buffer for save-excursion + set-buffer.
>
> >> - should not `setq` on a global variable that doesn't have an
> appropriate
> >> namespace prefix.
> >>
> > Do you mean the following is not allowed:
> >
> > (setq apple 'banana)
> >
> > but the following code is allowed:
> >
> > (setq dmp-apple 'banana)
>
> Neither are recommended without first declaring that global variable
> (since that's what it is: a global variable).
> And global declarations need to use a proper namespace prefix.
> Otherwise you're at risk of stepping on someone else's toes/variables.
>
>
> Stefan
>
>
[-- Attachment #2: Type: text/html, Size: 2698 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-14 2:30 ` Davin Pearson
@ 2022-07-14 4:42 ` Davin Pearson
2022-07-14 14:13 ` Stefan Monnier
1 sibling, 0 replies; 20+ messages in thread
From: Davin Pearson @ 2022-07-14 4:42 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2734 bytes --]
Here are some changes to my earlier email:
It is rather unlikely that there is another dmp who uses Elisp
out there in the world today.
Short of a rewrite of the Elisp code base I recommend that
Lisp namespaces be allocated on a first in first served basis,
which is how internet domain names are allocated.
A more ideal solution would be to borrow Java's package
system into Elisp. My package name will be nz.davinpearson.
This is a bit unwieldy as it is much easier to use dmp as
the name of my package. Perhaps someone out there can
come up with a system that combines the tersity of dmp with
the guarantee that you will not be treading on someone
else's code, like how Java does it....
On Thu, 14 Jul 2022 at 14:30, Davin Pearson <davin.pearson@gmail.com> wrote:
> Is dmp a reasonable prefix for global variables?
>
> I once used my-* for my global variables but abandoned it
> when other people started to use my code.
>
> It is rather unlikely that there is a dmp out there in the world today.
>
> Lisp namespaces should be allocated on a first in first served basis,
> which is how internet domain names are allocated.
>
>
>
> On Thu, 14 Jul 2022 at 13:48, Stefan Monnier <monnier@iro.umontreal.ca>
> wrote:
>
>> > I use debugging checkpoints every second line
>> > so the following code cannot be written:
>> >
>> > (defun foo ()
>> > (progn
>> > (progn
>> > (zip)
>> > (message "&apple:1")
>> > (zap)
>> > (message "&apple:2")
>> > (boo)
>> > (message "&apple:3")
>> > (bum)
>> > (message "&apple:4"))))
>>
>> I do use separate lines for closing parens every once in a while, don't
>> get me wrong. It's just an exception rather than a rule.
>> [ Note also that inserting/removing such `message` needs to be different
>> for the last element in any case because it determines the return
>> value. ]
>>
>> >> importantly:
>> >> - should use `with-current-buffer`.
>> >
>> > is that instead of (set-buffer buf)?
>>
>> If you compile the code, the byte-compiler will give you a warning
>> suggesting to replace with-current-buffer for save-excursion + set-buffer.
>>
>> >> - should not `setq` on a global variable that doesn't have an
>> appropriate
>> >> namespace prefix.
>> >>
>> > Do you mean the following is not allowed:
>> >
>> > (setq apple 'banana)
>> >
>> > but the following code is allowed:
>> >
>> > (setq dmp-apple 'banana)
>>
>> Neither are recommended without first declaring that global variable
>> (since that's what it is: a global variable).
>> And global declarations need to use a proper namespace prefix.
>> Otherwise you're at risk of stepping on someone else's toes/variables.
>>
>>
>> Stefan
>>
>>
[-- Attachment #2: Type: text/html, Size: 4034 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-14 2:30 ` Davin Pearson
2022-07-14 4:42 ` Davin Pearson
@ 2022-07-14 14:13 ` Stefan Monnier
1 sibling, 0 replies; 20+ messages in thread
From: Stefan Monnier @ 2022-07-14 14:13 UTC (permalink / raw)
To: Davin Pearson; +Cc: emacs-devel
> Is dmp a reasonable prefix for global variables?
Any prefix is potentially reasonable, yes.
IIUC the code under discussion is an example in a piece of text
discussing ELisp coding style, so which prefix is used doesn't matter,
the important thing is not to set a bad example of code using no prefix
at all.
Given that the example function uses `manifest-` as prefix, I'd
recommend you use `manifest-` as a prefix for the variable as well.
> I once used my-* for my global variables but abandoned it
> when other people started to use my code.
In code which is intended to be shared with other people to use, `my-`
is probably not the best choice, indeed. But for your own personal
code, `my-` is fine (and if people copy&use that code anyway, it becomes
their own personal code, so `my-` is also fine).
> It is rather unlikely that there is a dmp out there in the world today.
I can definitely imagine someone using `dmp-` as a prefix for some
package, tho I don't know if that's the case currently, indeed.
> Lisp namespaces should be allocated on a first in first served basis,
> which is how internet domain names are allocated.
That's pretty much how it works out, tho allocation is "de facto".
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Special Event: Davin reveals his own personal additions to Emacs.
2022-07-10 3:39 Special Event: Davin reveals his own personal additions to Emacs Davin Pearson
` (2 preceding siblings ...)
2022-07-10 12:57 ` Stefan Monnier
@ 2022-07-17 1:43 ` Davin Pearson
3 siblings, 0 replies; 20+ messages in thread
From: Davin Pearson @ 2022-07-17 1:43 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]
To install these features, download the following file: Do this
even if you already have downloaded the tarball as my new tarball
contains modified code:
http://davinpearson.nz/screenshots/java-training-wheels--bagatelles_20220717-133942.tar.gz
then untar the tarball to your $HOME folder, or any other folder
at your own risk. Then add the following line of code to your
$HOME/.emacs code:
(load-file "~/java-training-wheels/.emacs")
Start emacs by clicking on the Emacs icon or the command: emacs
On Sun, 10 Jul 2022 at 15:39, Davin Pearson <davin.pearson@gmail.com> wrote:
>
> Click on the following link to take you to a gallery of Emacs
> screenshots showing the hows and whys I have added my own personal
> additions to Emacs.
>
> http://davinpearson.nz/screenshots
>
> The most important and probably the most useful customisation that I
> have is a drop in replacement for M-y. Instead of cycling through the
> kill ring, it brings up a window showing the kill ring in the order of
> the kill ring. You then click on the ENTER button of paste from the
> kill ring to the last buffer you were editing.
>
> In all my code I use the practice of prefixing all of my functions and
> variables with <tt>dmp</tt> where DMP stands for Davin Max Pearson
> which is my name. I am unsure of just how useful this practice is for
> adding to the Emacs sources.
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 1956 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2022-07-17 1:43 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-10 3:39 Special Event: Davin reveals his own personal additions to Emacs Davin Pearson
2022-07-10 8:56 ` Philip Kaludercic
2022-07-12 23:20 ` Davin Pearson
2022-07-10 11:45 ` Jean Louis
2022-07-12 22:35 ` Davin Pearson
2022-07-13 3:08 ` Stefan Monnier
2022-07-13 22:57 ` Davin Pearson
2022-07-14 1:47 ` Stefan Monnier
2022-07-14 2:30 ` Davin Pearson
2022-07-14 4:42 ` Davin Pearson
2022-07-14 14:13 ` Stefan Monnier
2022-07-10 12:57 ` Stefan Monnier
2022-07-10 16:03 ` Document that symbol prefix "my-" (or other) should be left for users Teemu Likonen
2022-07-10 16:59 ` Stefan Kangas
2022-07-10 18:11 ` Bozhidar Batsov
2022-07-10 19:20 ` Tim Cross
2022-07-11 3:17 ` Richard Stallman
2022-07-10 18:22 ` Special Event: Davin reveals his own personal additions to Emacs Clément Pit-Claudel
2022-07-10 19:50 ` Rudolf Adamkovič
2022-07-17 1:43 ` Davin Pearson
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.