Article View: gnu.epoch.misc
Article #811Re: Saving tabs in a file?
From: Colin Owen Rafferty
Date: Wed, 11 Aug 1993 15:31
Date: Wed, 11 Aug 1993 15:31
90 lines
4440 bytes
4440 bytes
>>>>> In article <1993Aug10.140522.25577@dvorak.amd.com>, drp@dvorak.amd.com (Doug Puchalski) writes:
> Anybody know how to save tab stop information along with a file? Perhaps
> encode them in a special comment or something?
If the tab stop information is static, then you can change it by using
the "Local Variables" in a comment at the end of the file. This is an
emacs thing -- not epoch-specific.
For example, if you wanted to do something goofy in a C file, you
could have this near the end of the file:
/*
* Local Variables:
* tab-stop-list:(1 2 3 5 8 13 21 34 55 89 144)
* End:
*/
If you're not certain how local variable work, type in the following
key sequence:
C-h i d m e m a c s RET m f i l e SPC v a r RET
Now, for saving any changes to the tab stops without manually setting
the local variables list, that's a tougher question. I guess if you
wrote a function that automatically created the local variables list
with the current information, and you put that on the front of
write-file-hooks, that would work.
Actually, the function would have to be able to create a new local
variables list or edit an existing one. In fact, the function would
have to be smart enough to replace an existing value of tab-stop-list,
and it would have to be able to figure out an appropriate method of
commenting the local variables list out. It would even be pretty
straightforward to have a list of symbols which you want to save on
the local variables list.
So the code is below. If someone actually writes this, please give me
credit for the inspiration.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'cor)
(defvar cor::auto-save-locals t
"*nil value means to always never the local variables of the buffers.")
(defvar cor::always-symbol-list '()
"*List of symbols which will always be saved.")
(defvar cor::never-symbol-list '()
"*List of symbols which will never be changed.")
(defvar cor::save-mode-alist
'(("C" . ("/* " " * " " */"))
("C++" . "// ")
("Emacs-Lisp" . ";; ")
("Text" . ("" "-- "))
("Mail" . nil)
(nil . ("")))
"*AList of pairs of the form (NAME . PREFIX) or (NAME . (FIRST PREFIX LAST))
where NAME stands for the value of `mode-name' to match, and FIRST
precedes the first line of the list, PREFIX is the prefix to each line
of the list, and LAST goes after the list line of the list.
A nil as the PREFIX means to never do the save-local-variables in this mode.")
(defun cor::save-local-variables ()
"This function updates the local variables list of the current buffer.
It will only do something if it is either called interactively or if
`cor::auto-save-locals' is non-nil and the matching mode in
`cor::save-mode-alist' has a non-nil value.
It will save all symbols which are either:
1. On the list `cor::always-symbol-list'.
2. Already in the Local Variables section of the buffer but not on
the list `cor::never-symbol-list'."
(interactive)
;;
;; insert real code here.
;;
)
--
///
o o
-----------------------------------------------------------oOO-(_)-OOo--------
Colin Owen Rafferty | e-mail: craffert@lehman.com
Lehman Brothers | phone: (212) 640-6263
|
pgp public key by email or finger; print = 91FED077 BD5588B6 30B372D2 F9172162
Don't know what pgp is? Ask me!
------------------------------------------------------------------------------
Technical Details
Message-ID:
<CRAFFERT.93Aug11103116@nostril.lehman.com>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!agate!doc.ic.ac.uk!uknet!pipex!uunet!psinntp!lehman.com!newshost!craffertReferences:
<1993Aug10.140522.25577@dvorak.amd.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,5a31dc09d6780a7c X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1993-08-11 10:31:35 PST Newsgroups: gnu.epoch.misc Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!agate!doc.ic.ac.uk!uknet!pipex!uunet!psinntp!lehman.com!newshost!craffert From: craffert@nostril.lehman.com (Colin Owen Rafferty) Subject: Re: Saving tabs in a file? In-Reply-To: drp@dvorak.amd.com's message of Tue, 10 Aug 93 14:05:22 GMT Message-ID: <CRAFFERT.93Aug11103116@nostril.lehman.com> Sender: news@lehman.com (News) Organization: Lehman Brothers References: <1993Aug10.140522.25577@dvorak.amd.com> Date: Wed, 11 Aug 1993 15:31:16 GMT Lines: 90