From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Allan Adler Newsgroups: gmane.emacs.help Subject: some emacs commands at end of file Date: 20 Jan 2007 23:34:30 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1169354431 25278 80.91.229.12 (21 Jan 2007 04:40:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 21 Jan 2007 04:40:31 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 21 05:40:28 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H8UVH-000549-T3 for geh-help-gnu-emacs@m.gmane.org; Sun, 21 Jan 2007 05:40:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H8UVH-0000Nm-BC for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Jan 2007 23:40:27 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!dreaderd!not-for-mail Original-Newsgroups: gnu.emacs.help X-Newsreader: Gnus v5.7/Emacs 20.7 Original-Lines: 65 Original-NNTP-Posting-Host: nestle.csail.mit.edu Original-X-Trace: 1169354070 senator-bedfellow.mit.edu 562 128.30.16.13 Original-Xref: shelby.stanford.edu gnu.emacs.help:144879 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40483 Archived-At: 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 * 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.