all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@wmi.amu.edu.pl>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: A question about cycle-spacing--context
Date: Mon, 26 Jan 2015 00:28:19 +0100	[thread overview]
Message-ID: <87twzefnjg.fsf@wmi.amu.edu.pl> (raw)

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	other threads:[~2015-01-25 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 23:28 Marcin Borkowski [this message]
2015-01-26  0:38 ` A question about cycle-spacing--context Drew Adams
2015-01-26  1:48   ` Artur Malabarba
2015-01-26  3:10     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twzefnjg.fsf@wmi.amu.edu.pl \
    --to=mbork@wmi.amu.edu.pl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.