From: Allan Adler <ara@nestle.csail.mit.edu>
Subject: some emacs commands at end of file
Date: 20 Jan 2007 23:34:30 -0500 [thread overview]
Message-ID: <y93odotknft.fsf@nestle.csail.mit.edu> (raw)
In the C source code to a math package called GAP 3, there are some
emacs commands hidden in a comment at the end of the file, something
like this (I copied this by hand):
/***************************************************
*E Emacs ................... local emacs variables
**
** Local Variables:
** mode: outline
** outline-regexp: "*A\\|*F\\|*V\\|*T\\|*E"
** fill-column: 73
** fill-prefix: "** "
** eval: (local-set-key "\t" 'c-indent-command')
** eval: (local-set-key ";" 'electric-c-semi)
** eval: (local-set-key "{" 'electric-c-brace)
** eval: (local-set-key "}" 'electric-c-brace)
** eval: (hide-body)
** End:
*/
Because of this stuff at the end of the file, if I run emacs and enter
the file, I get prompted with a y or n question that I don't understand.
If I instead type n to the prompt, I just get the file as it is.
If I type y, then all of the lines in the file that begin with *A,*F,*V,
*T or *E are displayed and none of the other lines. This is a display
that looks like just a few lines. If I go to the beginning of those few lines
and execute M-x set-mark and then go to the end and hit C-W to put them
in the yank buffer, and then go to an empty buffer and hit C-y, instead
of just those lines I get the full contents of the file. So this is all
about display, just smoke and mirrors, not the actual content of the file.
I've been trying to make some sense of these commands, since it seems to
be a very useful technique to be able to display just certain particularly
important lines. Here are some questions:
(1) What exactly is it that causes emacs to treat the material in the
C comments as commands instead of as text?
(2) At what point does it start and at what point does it end?
(3) Why can't I find everything in the comments in the documentation for
GNU emacs or in the documentation for GNU emacs lisp?
I have a theory about (3), even though I don't know enough to really have
a theory. My theory is that when it says
mode: outline
it tells emacs to go into something called outline mode. Maybe an outline
is a selection of particular lines, such as I find displayed when I type
y in reply to the prompt. On the other hand, since it is a C file, maybe
the mode that handles C files has some smarts beyond the formatting of C
that makes it respond to some of these commands. For example, I couldn't
find c-indent-mode or electric-c-semi or electric-c-brace in any of the
documentation, so I'm guessing that maybe they are in the .el file that
tells emacs how to handle C files. Using grep, I found a file c-mode.elc
but no file c-mode.el. So, I guess I need to download c-mode.el for
emacs 20.7 from somewhere and try to read it.
Even if that theory is right, I'm not sure what the respective roles are
of outline mode and C mode in this. I noticed something about major and
minor modes in the elisp documentation but haven't made sense of it yet.
--
Ignorantly,
Allan Adler <ara@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
next reply other threads:[~2007-01-21 4:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-21 4:34 Allan Adler [this message]
2007-01-21 4:47 ` some emacs commands at end of file Leo
2007-01-21 4:50 ` Leo
[not found] ` <mailman.3377.1169355310.2155.help-gnu-emacs@gnu.org>
2007-01-22 8:24 ` Allan Adler
2007-01-22 19:31 ` Robert Thorpe
2007-01-23 19:32 ` Allan Adler
2007-01-21 7:57 ` Nikos Apostolakis
[not found] ` <mailman.3380.1169366265.2155.help-gnu-emacs@gnu.org>
2007-01-22 8:29 ` Allan Adler
2007-01-22 10:49 ` Robert D. Crawford
2007-01-22 17:41 ` Allan Adler
2007-01-22 18:19 ` Robert D. Crawford
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=y93odotknft.fsf@nestle.csail.mit.edu \
--to=ara@nestle.csail.mit.edu \
/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.
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).