unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* A question about cycle-spacing--context
@ 2015-01-25 23:28 Marcin Borkowski
  2015-01-26  0:38 ` Drew Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Borkowski @ 2015-01-25 23:28 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hello Emacsers,

as I mentioned elsewhere, I'm studying simple.el (whose name I consider
a bit, hm, ironic;-)).  Here's what I found in the definition of
cycle-spacing:

(cons n (cons orig-pos (buffer-substring start (point))))

Is there any particular reason for using this instead of just

(list n orig-pos (buffer-substring start (point)))?

(Of course, the results are formally different, but functionally the
same, and in the current implementation, thus defined
cycle-spacing--context is not even a "proper", nil-terminated list!)

I understand that the current implementation saves memory (but taking
into account that there is one instance of cycle-spacing--context per
Emacs instance (!), this is negligible).  I guess it *might* improve
performance - but again, this is an interactive command clearly not
intended for non-interactive use, so saving a microsecond or two (and
I guess much less in reality) is not really a gain.  OTOH, we pay for
this with less readable code.

So, my question is: (1) why is that so and (2) would it be a good
practice to employ such an idea in my own code?  (I suppose the answers
are (1) why not? and (2) no, but I'd like to ask anyway.)

Also, this is yet another time I see a symbol with two consecutive
dashes.  This might be a naive question, but is there any convention
used here that I do not know of?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

end of thread, other threads:[~2015-01-26  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-25 23:28 A question about cycle-spacing--context Marcin Borkowski
2015-01-26  0:38 ` Drew Adams
2015-01-26  1:48   ` Artur Malabarba
2015-01-26  3:10     ` Drew Adams

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