Thread View: gnu.epoch.misc
2 messages
2 total messages
Started by Doug Puchalski
Tue, 10 Aug 1993 14:05
Saving tabs in a file?
Author: Doug Puchalski
Date: Tue, 10 Aug 1993 14:05
Date: Tue, 10 Aug 1993 14:05
4 lines
753 bytes
753 bytes
Another one: Anybody know how to save tab stop information along with a file? Perhaps encode them in a special comment or something?
Re: Saving tabs in a file?
Author: 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!
------------------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads