help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question about cycle-spacing--context


From: Marcin Borkowski
Subject: A question about cycle-spacing--context
Date: Mon, 26 Jan 2015 00:28:19 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]