[comp.emacs] How to Add a Hook/Diffs to Previously Munged Posting/Question

gaynor@topaz.RUTGERS.EDU (Silver) (05/07/87)

First, the hooks...

escott%deis.UCI.EDU@ROME.UCI.EDU (Scott Menter) writes:
> There is no "auto-save-hook".

There is also no fundamental-mode-hook (which surprised me).  The
solution I used was to redefine the function in question to execute a
hook (If it doesn't do it, *MAKE* it do it.).  Below I include the
code.

;; Define fundamental-mode to execute fundamental-mode-hook.
;; Ram THIS up your .emacs!  <:^D

(defvar fundamental-mode-hook nil
"Hey!  Either grow some brains or chop off your
head.  No sense having one without the other.
  - gaynor@topaz"

(fset 'fundamental-mode
  (append
     (symbol-function 'fundamental-mode)
     '((run-hooks 'fundamental-mode-hook))))

I assume that the mods for your problem are now trivial.  Just replace
references to fundamental-mode with auto-save-mode.


Second, the diffs...

Did anybody try (or even look at) that piece of code I posted?  I
munged it somehow WHILE POSTING it, so here I include the diffs
between what I posted and what I'm now using.  I had thought I cleared
things up with the immediately following posting, but I'm not so sure.
I made some other small changes, mostly stylistic and cosmetic.

============================ begin diffs =============================
10c10
<       ;; This is the text of the buffer.
---
>       ;; This is the text of the buffer.  Remember to escape \s and "s!
135c135
< "))
---
> ")
168a169,173
>   ;; Move the point to the end of the first line, kissing the old
>   ;; point bye-bye.
>   (goto-char (point-min))
>   (end-of-line)
> 
171,173c176
<   (if (equal (buffer-substring
<                (progn (goto-char (point-min)) (point))
<                (progn (end-of-line) (point)))
---
>   (if (equal (buffer-substring (point-min) (point))
180c183
<       ;; second line of the file...
---
>       ;; second line of the file (kissing the original mark bye-bye).
190c193
<           (progn (forward-char 1) (point))
---
>           (1+ (point))
195,196c198
<       (goto-char (point-min))
<       (message "Inserting default outline-regexp info...")
---
>       (message "inserting default outline-regexp info...")
============================= end diffs ==============================


Last, the question...

How are buffers and windows structured in GNU Emacs?  What I mean is,
how might I access buffer and window structures internally, in Lisp?
I looked for variables like `buffers', `buffer-list', ..., `windows',
`window-list', ..., but came up with nil.


name:  Andy Gaynor (Silver)
uucp:  {ames, cbosgd, harvard, moss, seismo}!topaz.rutgers.edu!gaynor
arpa:  GAYNOR@TOPAZ.RUTGERS.EDU