IMD 1.17: 19/01/2010 20:57:09 4404 emacs v1.1 2 of 3 Tektronix 4400P32 Emacs -- Version 1.1V 2' UniFLEX Backup.dABBB .dB0CCC,<.dC|DDD\l.dDEEE܌ܜ.dEFFFܼ1h 1L96buffer-edit.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zppj2  !"#$%&'()*+,-./01234('&%$#"!  ; Buffer edit: this package provides an alternative binding for ^X^B. It ; creates a buffer listing in which you can engage in an interactive dialog ; with Emacs about the fate of each buffer. You can mark them for saving, ; deleting, closing, unsaving, and the like; when you exit from buffer-edit ; mode all of the marks are processed and the various buffers meet their ; fate. ; This is a real win when you are trying to edit a large system with files ; all over the place. ; ; The listing is sorted so tha g  L94buff.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zt the file buffers come first, and the cursor ; is left sitting on the line corresponding to the buffer in which you ; typed the ^X^B command. ; ; Brian K. Reid, Stanford University, August 1982 ; ; Modified by Jane Laursen, Tektronix, November 1984, to implement ; quit command and make file operations (close, reread, save) work. (declare-global &old-buffer) (defun (buffer-edit bufn keep line (setq &old-buffer (current-buffer-name)) (setq bufn &old-buffer) (list-buffers) (pop-to-buffer "Bufferluedefun first-non-blank$beginning-of-linewhilef|>="following-char  $forward-character"current-columnskip-forward-matchingchar$setq"Z."!=,&pone-line-buffer-listmsg list") (setq mode-line-format " Buffer edit. Commands: n p s c d r o m u e ? Exit: g or q") (end-of-file) (insert-string "x\n") (beginning-of-file) (ebuf-pretty-line) (next-line) (ebuf-pretty-line) (next-line) (set-mark) (while (& (! (looking-at "^x$")) (! (eobp))) (ebuf-pretty-line) (setq keep 1) (if (!= (ebuf-buffer-type) "File") (setq keep 2)) (if (= (ebuf-get-name) "Buffer list") (setq keep 0)) (if (!= keep 1) (progn (save-excursion (beginning-of-line) (set-mark) (end-of-line) (forward-character) (setq line (region-to-string)) (erase-region) (if (= keep 2) (progn (end-of-file) (insert-string line)) ) ) ) (next-line) ) ) (delete-next-character) (delete-next-character) (exchange-dot-and-mark) (error-occurred (re-search-forward ; this is so slimy... (concat "^.................." bufn)) (position-within-line) ) (novalue) ) ; Rewrite r) ) (ebuf-next-line (next-line) (while (! (| (ebuf-is-real-buffer) (eobp))) (next-line) ) (if (eobp) (previous-line)) (position-within-line) ) ; move up one line, but don't move into the column headings (ebuf-previous-line (previous-line) (beginning-of-line) (while (! (| (ebuf-is-real-buffer) (eobp))) (next-line) ) (position-within-line) ) ; enter a recursive edit on this buffer. (ebuf-edit (if (ebuf-is-real-buffer) (save-excursion (dethe listing format to make it nicer, and to leave room for flags (ebuf-pretty-line (if (= (ebuf-buffer-type) "File") (progn (ebuf-goto 42) (while (looking-at " ") (delete-next-character)) ) ) (ebuf-goto 16) (insert-string " ") (beginning-of-line) ) ; Return the string type of the buffer listed in the current line. (ebuf-buffer-type (save-excursion (ebuf-goto 9) (set-mark) (goto-character (+ (dot) 4)) (region-to-string) ) ) lete-other-windows) (pop-to-buffer (ebuf-get-name)) (message "Beginning recursive edit...") (sit-for 5) (recursive-edit) (pop-to-buffer "Buffer list") (position-within-line) ) (error-message "not a buffer") ) ) ; exit from this buffer-editing routine, and fill the screen with current buf (ebuf-exit where (if (ebuf-is-real-buffer) (progn (setq where (ebuf-get-name)) (message "Exiting to buffer " where " ...") (ebuf-cleanup) (pop-to-buffer where) (d ; Return the name attached to the buffer listed in the current line ; This is pretty tricky because the buffer listing doesn't really delimit ; the buffer name properly. (ebuf-get-name (save-excursion (ebuf-goto 18) (set-mark) (end-of-line) (while (! (| (bolp) (= (preceding-char) ' '))) (backward-character)) ; move past file name (while (& (! (bolp))(= (preceding-char) ' ')) (backward-character)) ; move past blanks (while (! (| (belete-other-windows) ) (error-message "not a buffer") ) ) (ebuf-quit (pop-to-buffer &old-buffer) (delete-other-windows) ) (ebuf-open where (if (ebuf-is-real-buffer) (progn (setq where (ebuf-get-name)) (pop-to-buffer &old-buffer) (delete-other-windows) (if (= where &old-buffer) (split-current-window) (pop-to-buffer where)) ) ) ) ) (defun ; mark current buffer for closing (write and then delete) (ebuf-olp) (= (preceding-char) ' '))) (backward-character)) ; move past mode name (while (& (! (bolp)) (= (preceding-char) ' ')) (backward-character)) ; move to end of buffer name (region-to-string) ) ) ; return 1 if this is a real buffer and 0 if it is not (ebuf-is-real-buffer v (setq v (ebuf-buffer-type)) (& (!= v "Type") (!= v "----")) ) ; return the status character (D for deleted, etc.) that we put there (ebuf-status (ebuf-goto 16) (following-chaclose (ebuf-flag-column 16 'C')) ; mark the current buffer for deletion without writing (ebuf-delete (ebuf-flag-column 16 'D')) ; mark the current buffer for saving (ebuf-save (ebuf-flag-column 16 'S')) ; mark the current buffer for nonnsaving (ignore "buffer-is-modified" flag) (ebuf-mark (ebuf-flag-column 16 'N')) ; mark current buffer for reverting (reread file contents) (ebuf-revert (ebuf-flag-column 16 'R')) ; unmark the current buffer for all actions (ebuf-undelete (ebuf-flag-column 16 ' ') ) ; Put a flag character given as argument 2 into the column given as arg 1 (ebuf-flag-column (temp-use-buffer "Buffer list") (ebuf-goto (arg 1)) (delete-next-character) (insert-character (arg 2)) (position-within-line) ) (ebuf-goto (beginning-of-line) (goto-character (+ (dot) (arg 1))) ) ; put the cursor where we want it (position-within-line (ebuf-goto 17) ) (mouse-position-within-lingn (if (error-occurred (save-excursion (if (= (ebuf-buffer-type) "File") (progn (temp-use-buffer ebuf-name) (write-current-file)) ) ) ) (message-char (concat ebuf-name " cannot be written to file." " Closing fails.")) (progn (delete-buffer ebuf-name) (beginning-of-line) (kill-to-end-of-line) (delete-next-character) ) ) ) (= bstat 'N') ; nonsave: mark unmodified (progn e (move-dot-to-mouse) ; from tek4404.ml (position-within-line) ) (mouse-ebuf-exit (mouse-ignore-button) ; from tek4404.ml (ebuf-exit) ) (mouse-ebuf-open (mouse-ignore-button) (ebuf-open) ) ) (defun (message-char (message (concat (arg 1) " Press to continue.")) (get-tty-character) ) (ebuf-cleanup bstat ebuf-name (pop-to-buffer "Buffer list") (beginning-of-file) (next-line) (next-line) (while (! (eobp)) (setq bstat (ebuf-status))  (save-excursion (temp-use-buffer ebuf-name) (setq buffer-is-modified 0) ) (ebuf-flag-column 14 ' ') (next-line) ) (= bstat 'R') ; revert buffer (progn (save-excursion (if (= (ebuf-buffer-type) "File") (progn (temp-use-buffer ebuf-name) (if (error-occurred (read-file (current-file-name)) (ebuf-flag-column 14 ' ')) (message-char (concat ebuf-name " cannot be reread."))) ) )) (next-l (setq ebuf-name (ebuf-get-name)) (if (= bstat 'D') ; delete without saving (progn (if (error-occurred (delete-buffer ebuf-name)) (message-char (concat ebuf-name " cannot be deleted."))) (beginning-of-line) (kill-to-end-of-line) (delete-next-character) ) (= bstat 'S') ; save buffer (progn (save-excursion (if (= (ebuf-buffer-type) "File") (progn (temp-use-buffer ebuf-name) (if (error-occurred (write-currenine) ) (next-line) ) (beginning-of-line) ) ) (ebuf-beep (error-message "Cmds: Next, Prev, Save, Close, Delete, Reread, Mark, Unmark, Edit, Goto, Open, Quit, ?") ) ) (defun (ebuf-help (pop-to-buffer "Help") (erase-buffer) (insert-string " Move cursor to line for a buffer, then type a command:\n" " n,^N,sp -- move to next line\n" " p,^P,^H -- move to previous line\n" " s -- save buffer (write to associated file)\n"t-file) (ebuf-flag-column 14 ' ')) (message-char (concat ebuf-name " cannot be written to file."))) ) (progn (temp-use-buffer ebuf-name) (if (error-occurred (write-named-file (get-tty-file (concat "File for " ebuf-name ": "))) ) (message-char (concat ebuf-name "cannot be written to file."))) ) ) ) (next-line) ) (= bstat 'C') ; close--save then delete (pro " c -- close buffer (write to file, then delete buffer)\n" " d -- delete buffer (erase the buffer, not affecting the file)\n" " r -- reread from file\n" " m -- mark as not modified (remove the 'needs saving' flag)\n" " u -- unmark (undo edit-buffer marks)\n" " e -- recursive edit this buffer\n" " g, mouse-middle -- exit with processing, goto selected buffer\n" " o -- open window to previous buffer & selected buffer, with no processing\n"  " q -- quit without processing, return to previous buffer\n" " mouse-left -- move to line containing mouse\n" ) (beginning-of-file) (sit-for 0) (next-window) ) ) (bind-to-key "buffer-edit" "\^X\^B") (progn loop (save-excursion (temp-use-buffer "Buffer list") (define-keymap "ebuf-keymap") (use-local-map "ebuf-keymap") (setq loop 0) (while (<= loop 127) (local-bind-to-key "ebuf-beep" loop) (setq loop (+ loop 1)) ) (setq loop '0') (while (<= lkey "argument-prefix" "\^U") (local-bind-to-key "previous-window" "\^Xp") (local-bind-to-key "previous-window" "\^XP") (local-bind-to-key "next-window" "\^Xn") (local-bind-to-key "next-window" "\^XN") (local-bind-to-key "delete-other-windows" "\^X1") (local-bind-to-key "next-page" "\^V") (local-bind-to-key "previous-page" "\ev") (local-bind-to-key "previous-page" "\eV") (local-bind-to-key "scroll-one-line-up" "\^Z") (local-bind-to-key "scroll-one-line-down" "\eZ") (local-binoop '9') (local-bind-to-key "digit" loop) (setq loop (+ loop 1)) ) (local-bind-to-key "ebuf-help" "?") (local-bind-to-key "ebuf-delete" "d") (local-bind-to-key "ebuf-delete" "D") (local-bind-to-key "ebuf-delete" " ") (local-bind-to-key "ebuf-previous-line" "p") (local-bind-to-key "ebuf-previous-line" "P") (local-bind-to-key "ebuf-previous-line" "") (local-bind-to-key "ebuf-previous-line" "") (local-bind-to-key "ebuf-next-line" "n") (local-bind-to-key "ebuf-next-line"d-to-key "beginning-of-file" "\e<") (local-bind-to-key "end-of-file" "\e>") (local-bind-to-key "return-to-monitor" "\^_") (local-bind-to-key "exit-emacs" "\^C") (local-bind-to-key "mouse-position-within-line" "\ePA1D") ; left mouse button (local-bind-to-key "mouse-ebuf-exit" "\ePA2D") ; middle mouse button (local-bind-to-key "mouse-ebuf-open" "\ePA3D") ; right mouse button ) ) command, you will see the contents of the file in your EMACS. You can edit the contents.  "N") (local-bind-to-key "ebuf-next-line" "") (local-bind-to-key "ebuf-next-line" " ") (local-bind-to-key "ebuf-close" "c") (local-bind-to-key "ebuf-close" "C") (local-bind-to-key "ebuf-edit" "e") (local-bind-to-key "ebuf-edit" "E") (local-bind-to-key "ebuf-undelete" "u") (local-bind-to-key "ebuf-undelete" "U") (local-bind-to-key "ebuf-exit" "g") (local-bind-to-key "ebuf-exit" "G") (local-bind-to-key "ebuf-save" "s") (local-bind-to-key "ebuf-save" "S") (local-bind-to-'i 'L97buffer-edit.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zkey "ebuf-mark" "m") (local-bind-to-key "ebuf-mark" "M") (local-bind-to-key "ebuf-revert" "r") (local-bind-to-key "ebuf-revert" "R") (local-bind-to-key "ebuf-quit" "q") (local-bind-to-key "ebuf-quit" "Q") (local-bind-to-key "ebuf-open" "o") (local-bind-to-key "ebuf-open" "O") (local-bind-to-key "ebuf-beep" "\^X\^B") (local-bind-to-key "redraw-display" "\^L") (local-bind-to-key "search-forward" "\^S") (local-bind-to-key "search-reverse" "\^R") (local-bind-to-@declare-global &old-buffer\defunn buffer-editbufnkeeplineDsetqP&current-buffer-namer  list-buffers> pop-to-buffer Buffer listzP$mode-line-formatP= Buffer edit. Commands: n p s c d r o m u e ? Exit: g or q end-of-file6 insert-stringx $beginning-of-file$ebuf-pretty-line next-lineset-markwhilez&H!4 looking-at^x$eobp &^keep|ifR!=$ebuf-buffer-typeFilevfollowing-char~ebuf-next-lineT$0,,  previous-line\ebuf-previous-line$ 0BZlr ebuf-editV  x(delete-other-windows Hmessage.Beginning recursive edit..."sit-for"recursive-edit> pop-to-bufferT:=  ebuf-get-name|"H4D(prognsave-excursion$beginning-of-line end-of-line$forward-character0$region-to-string  erase-region2$f ~(delete-next-character(exchange-dot-and-mark Buffer listl@ error-message  not a bufferP ebuf-exitwhereif&ebuf-is-real-buffer>setq  ebuf-get-name^message&Exiting to buffer , ...  ebuf-cleanup N F ebuf-quit$ &old-buffer0error-occurredjre-search-forwardFconcat&^..................(position-within-linenovalueh>P$ ebuf-goto*& x TzVt&~ 6Tgoto-character2+dotRPFJ ebuf-opennvRP LJ&v(split-current-window RldefunR ebuf-close4ebuf-flag-columnC4 ebuf-deleteD2 ebuf-saveS2 ebuf-markNN4 ebuf-revertR6 ebuf-undeleteb\|bolp0"preceding-char &backward-character2>&P ^f 2 &2 DR4d 2&  2 Nebuf-is-real-buffervZFNn$$Type$----N ebuf-status" (temp-use-buffer$arg(delete-next-character2insert-characterf4$beginning-of-line<goto-character.hXmouse-position-within-line$move-dot-to-mouseNmouse-ebuf-exit&mouse-ignore-button.mouse-ebuf-open message-charF@, Press to continue.$get-tty-characterbstat ebuf-name *$beginning-of-file next-line$eobpTxZ.*Dj,j& delete-buffer8T2~& cannot be deleted.&1 s -- save buffer (write to associated file) N: c -- close buffer (write to file, then delete buffer) VB d -- delete buffer (erase the buffer, not affecting the file) . r -- reread from file T@ m -- mark as not modified (remove the 'needs saving' flag) <) u -- unmark (undo edit-buffer marks) 8$ e -- recursive edit this buffer VB g, mouse-middle -- exit kill-to-end-of-line<tS<save-excursion60$ebuf-buffer-typeJ rBJ&write-current-file @:H. cannot be written to file.D zTwrite-named-file^ get-tty-file> File for : @>:h.cannotwith processing, goto selected buffer bN o -- open window to previous buffer & selected buffer, with no processing P< q -- quit without processing, return to previous buffer D0 mouse-left -- move to line containing mouse | next-windowR bind-to-key buffer-edit Vloop 8 N8> define-keymap be written to file.CJf<60T" PL<68$ Closing fails.$ 6:NhFV 4&buffer-is-modified JR(Z $\Z@ read-file$current-file-name  ebuf-keymap& use-local-mappz$<=F0local-bind-to-key :0^v9$digit  B? "d D p @&ebuf-previous-linep 82>& cannot be reread. ebuf-beeppjVCmds: Next, Prev, Save, Close, Delete, Reread, Mark, Unmark, Edit, Goto, Open, Quit, ?zt ebuf-helpHelp  erase-bufferL9 Move cursor to line for a buffer, then type a command: 4! n,^N,sp -- move to next line 8% p,^P,^H -- move to previous line DP b B<""ebuf-next-linen N B c tC6T ebuf-edite E Xu 8U g G ~@s ^ S >2m M $r R q Q ~o ^O>J<,"redraw-display <"search-forward<"search-reverse(defun (begin-C-comment (move-to-comment-column) (setq left-margin (current-column)) (setq right-margin 78) (setq prefix-string " ") (insert-string "/* ") ) ) (defun (end-C-comment (setq right-margin 1000) (if (!= (preceding-char) ' ') (insert-string " ")) (insert-string "*/") ) ) (defun (c-mode (setq right-margin 1000) (setq prefix-string " ") (setq mode-string "C") (remove-all-local-bindings) (local-bind-to-key "begin-C-comment" "`") (local-bind-to-key "end-C-comme<x"argument-prefix><"previous-windowp"P: next-windown"ND(delete-other-windows16< next-page<  previous-pagev"V@&scroll-one-line-upnt" "'") (local-bind-to-key "indent-C-procedure" "j") (novalue) ) ) beginning-of-file$ebuf-pretty-line next-lineset-markwhilez&H!4 looking-at^x$eobp &^keep|ifR!=$ebuf-buffer-typeFilevDh(scroll-one-line-downZ@$$beginning-of-file<"X>>$return-to-monitor8 exit-emacsLL.mouse-position-within-linePA1D@"mouse-ebuf-exitPA2D@"mouse-ebuf-openPA3Dle (<= l L98c-mode.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zNj OL98c-mode.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z\defunDbegin-C-comment*move-to-comment-columnXsetq left-margin"current-column.  right-marginN<~  prefix-string 6 insert-string/*  end-C-comment>pif@!="preceding-char > $*/hbc-mode&~8 mode-stringC,remove-all-local-bindings@local-bind-to-key,`"T'B&indent-C-procedurejnovalue|ifR!=$ebuf-buffer-typeFilevword-capitalize)) (forward-word) (backward-word)) ) uf-get-name|"H4D(prognsave-excursion$beginning-of-line end-of-line$forward-character0$region-to-string  erase-region2$f ~(delete-next-character(exchange-dot-and-mark5 6L98capword.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z   L99capword.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z; ; This package provides reasonable functions to mess with the case of the ; current word. All of them operate on the word that contains or immediately ; precedes the cursor, and move the cursor to the next word when they are ; done. Normally they are bound to ESC-U, ESC-L, and ESC-C. ; ; Brian Reid March 82 ; (defun (upper-case-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-upper) (forward-word) defunhupper-case-wordcprb4setqdot  backward-word  forward-wordtif >(8Lprogn^"case-word-upperVJ$lower-case-wordX"Td:0) (case-word-upper)) (forward-word) (backward-word)) (lower-case-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-lower) (forward-word)) (case-word-lower)) (forward-word) (backward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case-"case-word-lowerbcapitalize-word 6^P`@n(case-word-capitalizeer)) (forward-word) (backward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case-g hL99case-char.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zZ"+, novalue, bind-to-key 6^P`@n(case-word-capitalizeer)) (forward-word) (backward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case-(defun (case-character-invert c (prefix-argument-loop (if (! (eobp)) (progn (setq c (following-char)) (delete-next-character) (insert-character (if (& (<= 'a' c) (<= c 'z')) (- c 040) (& (<= 'A' c) (<= c 'Z')) (+ c 040) c))))) (novalue))) (bind-to-key "case-character-invert" '^^') rVJ$lower-case-wordX"Td:0 L99centre-line.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zs tL99case-char.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z; function to centre the current line (defun (centre-line width (save-excursion (beginning-of-line) (delete-white-space) (end-of-line) (delete-white-space) (setq width (current-column)) (beginning-of-line) (to-col (/ (- (+ left-margin (if (<= right-margin 200) right-margin (<= default-right-margin 200) default-right-margin 80) ) width) 2)) ) ) ) "-| .AZNFdefun.case-character-invertcprefix-argument-loopif,!eobpnprogn@setqV"following-char(delete-next-characterinsert-characterL&$<=az"-| .AZNE FL9:centre-line.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zDdefun, centre-linewidthsave-excursion$beginning-of-line&delete-white-space end-of-line@setqD"current-columnV to-col/-+ left-marginif><=  right-margin6(acs++ ") (progn (search-forward " ") (set-mark) (end-of-line) (setq command (region-to-string)) (if (eobp) (progn (newline) (end-of-file) (set-mark) (filter-region command) (insert-string "emacs++ ") ))) ))) rward-word) (backward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case-default-right-marginPe, bind-to-key 6^P`@n(case-word-capitalizeer)) (forward-word) (backward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case-# $L9:cheap.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z L9:cheap.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z@defun( cheap-shell@ pop-to-buffer  *cheap-shell*Tlocal-bind-to-keycheap-cr  erase-buffer< insert-stringemacs++ novalueXcommand$beginning-of-lineif$ looking-atP^progn6search-forward; cheap-shell opens a window that filters each command line through ; a pipe to the operating system. NOT effective for changing directory ; (use mlisp 'chd' function in pwd.ml). Handy for getting the results ; of a shell command into a window. (defun (cheap-shell (pop-to-buffer "*cheap-shell*") (local-bind-to-key "cheap-cr" "\n") (erase-buffer) (insert-string "emacs++ ") (novalue) ) ) (defun (cheap-cr command (beginning-of-line) (if (looking-at "em set-mark end-of-lineBsetq$region-to-stringeobpvnewline end-of-file,& filter-region@ ckward-word)) (capitalize-word cp rb (setq cp (dot)) (backward-word) (forward-word) (setq rb (dot)) (if (> cp rb) (progn (forward-word) (backward-word) (case-word-capitalize) (forward-word)) (case- ]  ^L9:comments.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z(defun (edit-block-comment (save-window-excursion esc-j mode (end-of-line) (re-search-reverse "^/\\*") (set-mark) (forward-character)(forward-character) (search-forward "*/") (if (eolp) (forward-character)) (debox-region) (setq esc-j (local-binding-of "\ej")) (local-bind-to-key "justify-paragraph" "\ej") (setq left-margin 0) (setq right-margin 75) (setq prefix-string "") (narrow-region) (messa(defun (box-region longest len (save-excursion (narrow-region) (beginning-of-file) (while (& (eolp) (! (eobp))) (delete-next-character)) (insert-string "\n") (setq longest 0) (error-occurred (while (! (eobp)) (end-of-line) (if (> (setq len (current-column)) longest) (setq longest len)) (forward-character))) (end-of-file) (while (& (! (bobp)) (= (preceding-char) '\n')) (delete-previous-characterge "Type ^C to resume editing") (setq mode mode-string) (setq mode-string "Comment edit") (save-excursion (recursive-edit)) (setq mode-string mode) (local-bind-to-key esc-j "\ej") (beginning-of-file) (set-mark) (end-of-file) (widen-region) (box-region) ))) vZFNn$$Type$----N ebuf-status")) (insert-string "\n\n") (beginning-of-file) (insert-string "/*") (setq len 0) (while (< len longest) (insert-string "*") (setq len (+ len 1))) (insert-string "*\\\n") (error-occurred (while (! (eobp)) (insert-string "* ") (end-of-line) (to-col (+ longest 3)) (insert-string " *") (forward-character))) (end-of-file) (insert-string "\\*") (setq len 0) (while (< len longest)  )  *L9;comments.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z (insert-string "*") (setq len (+ len 1))) (insert-string "*/\n") (widen-region) ))) (defun (debox-region (save-excursion (save-restriction (narrow-region) (beginning-of-file) (error-occurred (re-replace-string "/\\*[\\*]*" "")) (if (eolp) (delete-next-character)) (error-occurred (re-replace-string "[\\*]*\\*/[\n]*" "")) (error-occurred (re-replace-string "^\\* " "")) (error-occurred (re-replace-string "[ \t]*\\*$" "")))))) rdefunZ box-regionlongestlen save-excursion  narrow-region$beginning-of-filewhileX&eolp,!eobp(delete-next-character4 insert-string &setqerror-occurred .< end-of-linepifH>.b"current-column.$forward-character end-of-fileb Fbobp>="preceding-char ,delete-previous-character :/*n( <r*.f"2~:ebuf-next-lineT$0,,  previous-line\ebuf-previous-line$ 0BZlr ebuf-editV  x(delete-other-windows Hmessage.Beginning recursive edit..."sit-for"recursive-edit> pop-to-buffer+LR*\  * .to-colr *\*pDV6 ^ 8,2*/  widen-regionRL debox-region,&save-restrictionZTre-replace-stringN OL:debug.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z/\*[\*]* 2,  [\*]*\*/[ ]**V$f^\* .,(<[ ]*\*$Zd@^edit-block-comment8save-window-excursionesc-jmode<re-search-reverse^/\*set-mark8search-forward*/* ; debugging routines (defun (debug (setq compile-mlisp-debugging-hooks (! compile-mlisp-debugging-hooks)) (message "Packages that you load from now on " (if compile-mlisp-debugging-hooks "will" "won't") " be debuggable"))) (defun (show-error fn p (setq fn (break-file-name)) (setq p (break-character-position)) (if (= fn "") (message "The last error wasn't from an MLisp function.") (progn (visit-file fn) (widen-region) (goto-character p))) F:local-binding-ofjNlocal-bind-to-key$justify-paragraph, left-margin.  right-marginK,  prefix-stringpFmessage,Type ^C to resume editing*4 mode-string,   Comment edit("recursive-editBT (novalue))) (defun (single-step-handler fn p c ldot ret continue (setq ldot (dot)) (save-excursion (setq fn (break-file-name)) (setq p (break-character-position)) (visit-file fn) (goto-character p) (setq continue 1) (while continue (message "Single stepping... space->continue, s->skip, l->look, r->recurse, p->print") (setq c (get-tty-character)) (if (= c ' ') (progn (setq ret 1) (setq continue 0)) (= c 's') (progn (setq ret 0) (setq continue 0)) (= c 'l') (save-excursion (pop-to-buffer ldot) (goto-character ldot) (message "Dot is here.") (sit-for 10)) (= c 'r') (save-excursion (recursive-edit)) (= c 'p') (error-occurred v (setq v (get-tty-variable ": print ")) (message v " = " (execute-mlisp-line v)) (sit-for 10)) (= c '\^G') (error-message "Giving up") (progn (message "Huh?") (sit-for 10)) ) ) ) (if ret (&sttion.=ZF^@-The last error wasn't from an MLisp function.progn$ visit-file  widen-region(goto-characternovaluesingle-step-handler0@cldotretcontinue"dotsave-excursion>ep-through-arg-1) (arg 1)) )) (bind-to-key "show-error" "\es") [\*]*\*/[ ]**V$f^\* .,(<[ ]*\*$Zd@^edit-block-comment8save-window-excursionesc-jmode<re-search-reverse^/\*set-mark8search-forward*/* |, X bbwhile<d2^KSingle stepping... space->continue, s->skip, l->look, r->recurse, p->print0l$get-tty-characterT .pfhs..$&lB& pop-to-buffer &  Dot is here."Q RL:debug.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zsit-for <r("recursive-editperror-occurredvL@get-tty-variable: print N = ,execute-mlisp-line\ < error-message Giving up2Huh?@ P &&step-through-arg-1Pdefun8debugbsetq0compile-mlisp-debugging-hooks!message6#Packages that you load from now on LifTwillwon't" be debuggable show-errorfnp."break-file-name8h,break-character-posiarg: bind-to-key&slocal-bind-to-key$justify-paragraph, left-margin.  right-marginK,  prefix-stringpFmessage,Type ^C to resume editing*4 mode-string,   Comment edit("recursive-editBT L:des-word.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zription") (novalue) ) ) <r("recursive-editperror-occurredvL@get-tty-variable: print N = ,execute-mlisp-line\ < error-message Giving up2Huh?@ P &&step-through-arg-1 (extend-database-search-list "subr-names" "/emacs/databases/quickinfo") (error-occurred (extend-database-search-list "subr-names" (concat (getenv "HOME") "/.subr-names"))) ; describe-word-in-buffer takes the word nearest the cursor and looks it up ; in a database, then prints the information found. (defun (describe-word-in-buffer subr-name (if (> prefix-argument 1) (progn (error-occurred (forward-character)) (backward-word) (set-mark) (forward-word) (edit-description (reg L:des-word.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zion-to-string))) (progn (save-excursion (error-occurred (forward-character)) (backward-word) (set-mark) (forward-word) (setq subr-name (region-to-string)) (temp-use-buffer "subr-help") (erase-buffer) (if (error-occurred (fetch-database-entry "subr-names" subr-name)) (progn (delete-buffer "subr-help") (error-message (concat "No help for " subr-name))) (progn (beginning-of-file) (set-mark) (end-of-line) (message (rzextend-database-search-list subr-names./emacs/databases/quickinfoerror-occurredxhlconcat2getenvHOME  /.subr-namesdefundescribe-word-in-buffer subr-name4if>>"prefix-argumentprogn*$forward-egion-to-string)) (delete-buffer "subr-help") )) ) ) ) (novalue) ) (edit-description edit-name (setq edit-name (arg 1 ": edit-description (of routine) ")) (pop-to-buffer "Edit description") (erase-buffer) (if (error-occurred (fetch-database-entry "subr-names" edit-name)) (message "New entry.")) (setq mode-string (concat " Editing database entry for " edit-name)) (save-excursion (recursive-edit)) (put-database-entry "subr-names" edit-name) (delete-buffer "Edit desccharacter  backward-wordset-mark  forward-wordHedit-description$region-to-stringsave-excursion ,F\$setqP|>temp-use-buffer subr-help  erase-buffer2:4fetch-database-entryx& delete-bufferbL error-message,  No help for 4z$beginning-of-file end-of-line message $novalue edit-name^Rarg4 : edit-description (of routine) D pop-to-buffer$Edit descriptionB($ New entry.`* mode-string<0rrent-buffer-name)) (setq directory (arg 1 (concat ": dired on directory? [" Dired-directory "] "))) (if (= directory "") (setq directory Dired-directory)) (if (& (= "/" (substr directory -1 1)) (> (length directory) 1)) (setq directory (substr directory 1 -1))) (setq Dired-directory directory) (switch-to-buffer "dired") (use-local-map "&dired-keymap") (setq mode-line-format (concat " Editing directory: " directory " %M %[%p%] ? fo Editing database entry for ("recursive-edit2put-database-entryJ 8vL@get-tty-variable: print N = ,execute-mlisp-line\ < error-message Giving up2Huh?@ P &&step-through-arg-1r options")) (erase-buffer) (set-mark) (message (concat "Getting contents of " directory)) (sit-for 0) (fast-filter-region (concat "/bin/dir +b " (expand-file-name directory))) (beginning-of-file) (if (looking-at "Directory") (progn (kill-to-end-of-line) (kill-to-end-of-line) (beginning-of-file) (re-replace-string "^\\([^ ]*\\) " " \\1") (beginning-of-file) ) (progn (end-of-file) (error-message (region-! !L:dired.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zto-string)) ) ) (&dired-summary) (novalue) ) ) (defun (&dired-Mark-file-deleted (if (= 0 (buffer-size)) (error-message "dired already done!") (progn (beginning-of-line) (goto-character (+ (dot) 40)) ; LJM (if (looking-at " d") (progn (beginning-of-line) (error-message "Can't delete a directory with dired"))) (beginning-of-line) ; LJM (delete-next-character) (insert-string "D") (next-line) (beginn; This is an attempt at a dired package. ; The tek4404 version supports moving to file names with the mouse (left ; button), implements &dired-read-file for reading files into emacs buffers, ; and adds patches to make documented functions work. Jane Laursen, ; Tektronix, December 1984. (declare-global Dired-keymap-defined Dired-directory &dired-return-buffer) (setq Dired-keymap-defined 0) (setq Dired-directory (working-directory)) (defun (dired directory (setq &dired-return-buffer (cuing-of-line) ) ) ) (&dired-summary (message " q-uit, d-elete, u-ndelete, e-dit, r-ead, h-ide, n-ext, p-revious") ) (&dired-UnMark-file-deleted (if (= 0 (buffer-size)) (error-message "dired already done!") (progn (beginning-of-line) (delete-next-character) (insert-string " ") (next-line) (beginning-of-line) ) ) ) (&dired-backup-unmark (if (= 0 (buffer-size)) (error-message "dired already done!") (! (bobp)) (previous-line)) (beginning-of-line) (delete-next-character) (insert-string " ") (beginning-of-line) ) ) (defun (&dired-examine (save-excursion (error-occurred (visit-file (&dired-get-fname)) (message "Type ^C to return to DIRED") (recursive-edit) (delete-other-windows) ) ) ) ) (defun (&dired-read-file fname (save-excursion (if (error-occurred (setq fname (&dired-get-fname)) (visit-file fname)) (message-char (concat "Unable to ge"Couldn't delete " thisfile)) ) ) ) (next-line) ) (exit-dired) ) (&dired-return (erase-buffer "dired deletions") (switch-to-buffer "dired") (beginning-of-file) ) (&dired-done (beginning-of-file) (set-mark) (end-of-file) (copy-region-to-buffer "dired deletions") (switch-to-buffer "dired deletions") (use-local-map "&dired-deletions-keymap") (beginning-of-file) (re-replace-string "^ .*\n" "") (if (!= 0 (buffer-size)) (&dired-done-opt " fname)) (message (concat fname " read to emacs buffer")) ) ) (delete-other-windows) ) ) (defun (&dired-hide (beginning-of-line) (kill-to-end-of-line) (kill-to-end-of-line) ) (&dired-get-fname (save-excursion (beginning-of-line) (goto-character (+ (dot) 2)) ; LJM (set-mark) ; LJM (goto-character (+ (dot) 25)) (search-forward " ") ; LJM (goto-character (- (dot) 1)) ; LJM ; LJM (end-of-line) (concat Dired-directory "/"tions) (exit-dired)) ) (exit-dired (error-occurred (delete-buffer "dired deletions")) (delete-buffer "dired") (switch-to-buffer &dired-return-buffer) (message "Dired exited") ) (message-char (message (concat (arg 1) " Press to continue.")) (get-tty-character) ) (mouse-go-to-line (move-dot-to-mouse) (beginning-of-line) ) ) (progn loop (save-excursion (temp-use-buffer "dired") (define-keymap "&dired-keymap") (use-local (region-to-string)) ) ) (&dired-done-options (message "d-do deletions; q-query each deletion; e-exit,do not delete; r-return to dired") ) (&dired-exit-without-deleting (message "Really exit without deleting? [y/n]") (setq ans (get-tty-character)) (if (| (= ans 'y') (= ans 'Y')) (exit-dired) (&dired-done-options)) ) (&dired-query-deletions (while (! (eobp)) (if (= (following-char) 'D') (progn thisfile ans (setq thisfile (&dired-get-fname)) -map "&dired-keymap") (setq loop 0) (while (<= loop 127) (local-bind-to-key "&dired-summary" loop) (setq loop (+ loop 1)) ) (setq loop '0') (while (<= loop '9') (local-bind-to-key "digit" loop) (setq loop (+ loop 1)) ) (local-bind-to-key "&dired-Mark-file-deleted" "d") (local-bind-to-key "&dired-Mark-file-deleted" "D") (local-bind-to-key "&dired-Mark-file-deleted" "") (local-bind-to-key "&dired-backup-unmark" "\0177") (local-bind-to-key "previo (message (concat "Delete " thisfile "? [y/n]")) (setq ans (get-tty-character)) (if (| (= ans 'y') (= ans 'Y')) (if (unlink-file thisfile) (message-char (concat "Couldn't delete " thisfile)) ) ) ) ) (next-line) ) (exit-dired) ) (&dired-do-deletions (while (! (eobp)) (if (= (following-char) 'D') (progn thisfile (setq thisfile (&dired-get-fname)) (if (unlink-file thisfile) (message-char (concat us-line" "\^H") (local-bind-to-key "previous-line" "p") (local-bind-to-key "previous-line" "P") (local-bind-to-key "previous-line" "\^P") (local-bind-to-key "next-line" "n") (local-bind-to-key "next-line" "N") (local-bind-to-key "next-line" "\^N") (local-bind-to-key "next-line" 13) (local-bind-to-key "next-line" 10) (local-bind-to-key "next-line" " ") (local-bind-to-key "argument-prefix" "\^U") (local-bind-to-key "previous-window" "\^Xp") (local-bind-to-key "previous-window" "\^XP") (local-bind-to-key "next-window" "\^Xn") (local-bind-to-key "next-window" "\^XN") (local-bind-to-key "delete-window" "\^Xd") (local-bind-to-key "delete-window" "\^XD") (local-bind-to-key "delete-other-windows" "\^X1") (local-bind-to-key "&dired-examine" "\^X\^V") (local-bind-to-key "next-page" "\^V") (local-bind-to-key "previous-page" "\ev") (local-bind-to-key "previous-page" "\eV") (local-bind-to-key "beginning-of-file" "m nL:dired.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z\e<") (local-bind-to-key "end-of-file" "\e>") (local-bind-to-key "&dired-UnMark-file-deleted" "u") (local-bind-to-key "&dired-UnMark-file-deleted" "U") (local-bind-to-key "exit-dired" "\^C") (local-bind-to-key "&dired-done" "q") (local-bind-to-key "&dired-done" "Q") (local-bind-to-key "&dired-examine" "e") (local-bind-to-key "&dired-examine" "E") (local-bind-to-key "&dired-read-file" "R") (local-bind-to-key "&dired-read-file" "r") (local-bdeclare-global(Dired-keymap-defined"Dired-directory(&dired-return-buffer&setqz0$working-directorydefundired directory2b4&current-buffer-name0~arg`concat*: dired on directory? [x] Vind-to-key "&dired-hide" "h") (local-bind-to-key "&dired-hide" "H") (local-bind-to-key "mouse-go-to-line" "\ePA1D") (temp-use-buffer "dired deletions") (define-keymap "&dired-deletions-keymap") (use-local-map "&dired-deletions-keymap") (setq loop 0) (while (<= loop 127) (local-bind-to-key "&dired-done-options" loop) (setq loop (+ loop 1)) ) (setq loop '0') (while (<= loop '9') (local-bind-to-key "digit" loop) (setq loop (+ loop 1)) if.=b &J/0substr<> lengthD(0$8*switch-to-buffer@ use-local-map  &dired-keymap $mode-line-formatn* Editing directory: 88$ ) (local-bind-to-key "&dired-exit-without-deleting" "E") (local-bind-to-key "&dired-exit-without-deleting" "e") (local-bind-to-key "&dired-query-deletions" "Q") (local-bind-to-key "&dired-query-deletions" "q") (local-bind-to-key "&dired-do-deletions" "D") (local-bind-to-key "&dired-do-deletions" "d") (local-bind-to-key "&dired-return" "R") (local-bind-to-key "&dired-return" "r") ) ) g G ~ %M %[%p%] ? for options  erase-bufferset-markNmessage4(Getting contents of v"sit-forvfast-filter-regionP  /bin/dir +b *expand-file-name$beginning-of-fileR: looking-at Directoryprogn&kill-to-end-of-line\Zre-replace-string ^\([^ ]*\)  \1hZ end-of-fileD error-message$region-to-string"&dired-summarynovalue&dired-Mark-file-deleted, buffer-size, &dired already done!l&$beginning-of-lineTgoto-character2+dot6F^$region-to-string&dired-done-optionshbNd-do deletions; q-query each deletion; e-exit,do not delete; r-return to dired&dired-exit-without-deleting<n6#Really exit without deleting? [y/n]@fans$get-tty-characterf<|ylY exit-diredj&dired-query-deletio(jh dHd<H6#Can't delete a directory with dired"(delete-next-character4 insert-stringD next-line`ZjTA q-uit, d-elete, u-ndelete, e-dit, r-ead, h-ide, n-ext, p-revious&dired-UnMark-file-deleted^t 8 &dired-backunswhileeobpn0"following-charD8prognthisfileF@Delete ? [y/n]6F.dyY`$ unlink-file 6 0:$Couldn't delete 0 &dired-do-deletionsz. T@b Rp-unmarkr& Z>,!bobp  previous-line 8,V&&dired-examinesave-excursionerror-occurredB visit-file$&dired-get-fname4.Type ^C to return to DIRED"recursive-edit(delete-other-windowsj*d&dired-read-fileDHntD* (\\v@Df &dired-returnB erase-buffer"dired deletions<switch-to-bufferdired$beginning-of-file2 &dired-done .copy-region-to-buffer* FJ use-local-map*&dired-deletions-keymap,Bre-replace-stringfname"save-excursion^error-occurred0H$&dired-get-fname lb message-charBconcat"Unable to get  :v4( read to emacs bufferxP0 &dired-hide@nh"6goto-character@N(search-forward("-^ .* 6$!=rl,& delete-buffer$ ^.4(&dired-return-buffer&  Dired exitedRF@, Press to continue.(Nmouse-go-to-line$move-dot-to-mouseloopn(temp-use-buffer& define-keymap z $<=\Llocal-bind-to-key"&dired-summary F0^LZ9$jdigit ~F&,&dired-Mark-file-deleteddX "N7:  previous-line R*>,z -go-to-line" "\ePA1D") (temp-use-buffer "dired deletions") (define-keymap "&dired-deletions-keymap") (use-local-map "&dired-deletions-keymap") (setq loop 0) (while (<= loop 127) (local-bind-to-key "&dired-done-options" loop) (setq loop (+ loop 1)) ) (setq loop '0') (while (<= loop '9') (local-bind-to-key "digit" loop) (setq loop (+ loop 1)) p 2P  n dN D$ ~ j<X"argument-prefix>"previous-windowp"P: next-windown"N<`  delete-wd dL:elec-c.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zindowd"$D"^1>"&dired-examine6 next-page<l  previous-pagev"0V"<"> u U  jDq J; Elec-c is a set of routines to aid C program development. ; Written by Duane T. Williams ; ; EXECUTION ; ; Once the package is loaded, local key bindings and local abbreviations ; are initialized within a buffer by executing the function elec-c-mode. ; The most convenient way to do this is by including in your .emacs_pro ; file the commands: ; (autoload "elec-c-mode" "elec-c.ml") ; (auto-execute "elec-c-mode" "*.c") ; ; DESCRIPTION ; ; The main functions provided by this package are: ; ; 1. Expansion of$Q *Ne  .E tR Tr h ~H$jZPA1D   x|fLL2 <&p0Lv9. b\P C control constructs: if, else, while, do, switch, ; and for. The user types the keyword immediately followed by ; a space, which causes the construct to be expanded, and, in ; the typical case, the user is placed in recursive edit mode to ; fill in () or {}. When the filling in is complete, the user ; types ^C to exit the recursive edit. This should be done while ; the cursor is still within the () or {}. ; ; NOTE: the user is also placed in recursive edit mode to ; insert the constant expressio n following 'case' in a switch ; statement and should use ^C to move from the case constant ; expression to the body of the case. ; ; For example, when the user types a space following "if" the ; following appears in the buffer: ; ; if () { ; ; } ; ; and the cursor is between the parentheses. The user then ; enters some boolean expression within the parens, followed by ; ^C. The ^C will exit the recursive edit and cause the cursor ; to move to the body of the if construct. The user then eblock comments ; &elec-c-split-declarations 0 ; justification option ; ; 6. A C program justification function is bound to ESC-j. It will ; re-indent a block (bounded by "{}" (at the left margin)). It's ; a bit slow; expect to wait. You will be told when it's done. ; ; 7. #d and #i are defined as abbreviations for #define and #include, ; respectively. ; ; 8. There is a function called "comment" that allows you to enter ; comment mode manually (without typing "/*"). ; This can be used in editing existnters ; additional statements, the last of which should be followed by ^C. ; The cursor will be left on a new line immediately below the ; right brace, "}". If the user was on a blank line when he typed ; ^C, that line will have been deleted. ; ; 2. Various characters in C almost always come in pairs: {}, (), []. ; When the user types the first, he gets the second ; as well, with special formatting done for {}. You can always ; quote (with ^Q) the left "paren" to avoid the expansion. ; ; 3. Semicoing comments. You have to be ; inside a comment when you toggle comment mode ON. You can ; toggle comment mode OFF by either re-executing the comment ; function or, more simply, by typing ^C. ; ; There is a function called "verbatim", which causes all special ; elec-c processing to be turned off until the user types ^C. ; ; 9. "main" always goes at the left margin and expands as you expect it ; to. Typing "argc" within the parameter list of "main" ; causes automatic insertion of argv and their delon and linefeed try to put the user where it is likely he ; wants to be. The semicolon wants to go at the end of the line! ; ; 4. The slash and asterisk are bound to special functions that try to ; do the right thing as far as comments are concerned. When you ; type /* you will be put into commment mode, in which the control ; constructs are not expanded, and when you subsequently type */ ; comment mode is terminated. ; ; Comments are automatically justified. You get BLOCKED comments ; when you type clarations. ; ; 10. The quotation marks are bound to special functions that attempt to ; prevent expansions when you are inside quotations. If you find ; that expressions are suddenly not expanding as they should, then ; you have probably typed a quote mark without typing its closing ; mate. ; ; HISTORY ; 03-Apr-83 Duane Williams (dtw) at Carnegie-Mellon University ; Updated documentation and removed experimental functions in ; preparation for installation on /usr/local. ; ; 17-May-82 Duane Williams (dtwthe &elec-c-border-char (the default is '-') after ; the opening "/*" of a comment. To close a blocked comment, type ; the &elec-c-border-char immediately after a subsequent '*', ; presumably at the left end of the block. ; ; 5. Default settings of global variables: ; &elec-c-indent-width 4 ; indentation of expressions ; &elec-c-right-margin 75 ; fold comments here ; &elec-c-border-char '-' ; char for block comments ; &elec-c-border-size 75 ; border width ; &elec-c-comment-prefix " " ; for non-) at Carnegie-Mellon University ; Control constructs are now expanded via the new hooked ; abbreviation function. ; ; 02-Feb-82 Duane Williams (dtw) at Carnegie-Mellon University ; Created. (progn (setq-default &elec-c-split-declarations 0) ; USER MAY CHANGE (setq-default &elec-c-indent-width 4) (setq-default &elec-c-right-margin 75) (setq-default &elec-c-border-char '-') (setq-default &elec-c-border-size 75) (setq-default &elec-c-comment-prefix " ") (setq-default &elec-c-com ment 0) ; PRIVATE VARIABLES (setq-default &elec-c-box-comment 0) (setq-default inside-double-quote 0) (setq-default inside-single-quote 0) (declare-buffer-specific ; allow these variables to have &elec-c-indent-width ; different values in each &elec-c-comment ; elec-c buffer &elec-c-box-comment &elec-c-right-margin &elec-c-border-char &elec-c-border-size &elec-c-comment-prefix inside-double-quote inside-single-quote ) (defun (current-position (+ (dot) 0)) ; if insiment 2 (delete-next-character)) (delete-next-character) ) ) ) (pause-or-exit ; avoid accidentally exiting (if (< (recursion-depth) 1) ; emacs (pause-emacs) (exit-emacs) ) ) (pop-recursion ; leave recursive edit (expand-abbrev) (pause-or-exit) ) (skip-white-space ; skip over spaces and tabs (while (& (! (eolp)) (| (= (following-char) ' ') (= (following-char) ' '))) (forward-character)) ) (this-line-is-blank ; true if only wde a comment, returns the column of the star ; that initiates the comment; otherwise returns zero. ; (inside-c-comment position star-position (setq &elec-c-box-comment 0) (setq position (current-position)) (save-excursion (if (error-occurred (search-reverse "/*")) 0 (progn (setq star-position (+ 1 (current-column))) (if (looking-at (concat "/\\*" (char-to-string &elec-c-border-char))) (setq &elec-c-box-comment 1)) (if (| (error-occurred (search-fhite space (save-excursion ; on current line (beginning-of-line) (skip-white-space) (if (eolp) 1 0)) ) (kill-current-line ; delete current line (beginning-of-line) (if (eolp) (kill-to-end-of-line) (provide-prefix-argument 2 (kill-to-end-of-line))) ) (beginning-of-block mymark ; jump to head of {} block (insert-string "}") (setq mymark (dot)) (if (error-occurred (backward-brace)) (progn (goto-character mymark) (delete-previous-character)) (savorward "*/")) (< position (current-position))) star-position 0) ) ) ) ) (backward-brace level (if (error-occurred (search-reverse "}")) (error-message "Can't find end of block!")) (setq level 1) (while (> level 0) (re-search-reverse "[{}]") (if (= (following-char) '{') (setq level (- level 1)) (setq level (+ level 1))) ) ) (forward-brace level (if (error-occurred (search-forward "{")) (error-message "Can't find beginning of block!"e-excursion (goto-character mymark) (delete-previous-character)) ) ) (end-of-block ; jump to end of {} block (beginning-of-block) (forward-brace) ) (preceding-word ; return preceding word (backward-word) (set-mark) (forward-word) (region-to-string) ) ) (defun (elec-left-brace next-position old-mode ; insert brace pair (setq old-mode mode-string) (if (!(eolp)) (end-of-line)) ; else a mess (if (& (!(bolp)) ; beautify )) (setq level 1) (while (> level 0) (re-search-forward "[{}]") (if (= (preceding-char) '{') (setq level (+ level 1)) (setq level (- level 1))) ) ) (expand-abbrev space-position ; cause abbrev expansion without (setq space-position (dot)) ; leaving extra chars in buffer (insert-character '#') (backward-character) (insert-character ' ') (save-window-excursion (goto-character space-position) (if (= (following-char) ' ') (provide-prefix-argu (!= (preceding-char) ' ') ; space (!= (preceding-char) '\t')) ; tab (insert-character ' ')) (setq mode-string "block-body") (insert-string "{}") ; insert braces (backward-character) ; and format (newline-and-indent) (forward-character) ; find next position (if (eobp) ; avoid end of buffer (progn (newline) (backward-character)) ) (setq next-position (dot)) (previous-line) ; position for edit (elec-indent) (recursive-edit)  (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) ) (elec-left-paren next-position ; insert paren pair (insert-string "()") (backward-character) ) (elec-left-bracket next-position ; insert bracket pair (insert-string "[]") (backward-character) ) (elec-right-paren line next-position (insert-character (last-key-struck)) (save-excursion (backward-paren) (if (do ; expand and format (provide-prefix-argument 2 (backward-character)) (newline) (forward-character) (newline) (forward-character) (newline) (search-reverse ")") ; position for params (save-window-excursion (search-forward "{") ; find next position (setq next-position (dot)) ) (setq mode-string "main-parameters") (use-abbrev-table "elec-c-main-abbrevs") (local-bind-to-key "pop-recursion" "\^C") (recursive-edit) ; edit params (use-t-is-visible) (progn (setq line "") (sit-for 10)) (progn (beginning-of-line) (set-mark) (end-of-line) (setq line (region-to-string))) ) ) (message line) ) (elec-tab newcol (setq newcol (+ (current-column) &elec-c-indent-width)) (insert-character '.') (backward-character) (delete-white-space) (delete-next-character) (to-col newcol) ) (elec-function-format old-dot old-size (setq old-dot (+ (dot) 0)) (setq old-size (buffeabbrev-table "elec-c-abbrevs") (local-bind-to-key "pause-or-exit" "\^C") (goto-character next-position) (newline) ; open body (elec-indent) (save-window-excursion ; find next position (if (error-occurred (search-reverse "main")) (search-reverse "main")) (forward-brace) (setq next-position (dot)) ) (setq mode-string "main-body") (recursive-edit) ; edit body (goto-character next-position) (newline) (setq mode-string old-mode) 0 ) r-size)) (save-excursion (previous-line) (re-search-forward "^}") (set-mark) (backward-brace) (beginning-of-line) (exchange-dot-and-mark) (end-of-line) (forward-character) (filter-region (concat "indent " "-st " "-i" &elec-c-indent-width (if &elec-c-split-declarations " -bc " " -nbc ")) ) ) (goto-character (/ (* (buffer-size) old-dot) old-size)) (message "Done!") ) (elec-indent (end-of-line) (newline-and-indent) (p (elec-argc ; auto declare argc/argv (search-forward ")") (backward-character) (insert-string ",argv") (end-of-line) (newline) (insert-string "int argc;") (newline) (insert-string "char *argv[];") 0 ) (elec-if next-position old-mode ; insert if construct (setq old-mode mode-string) (insert-string " () {}") (backward-character) (newline-and-indent) (previous-line) (search-forward "(") (save-window-excursion (elec-inrovide-prefix-argument &elec-c-indent-width (insert-character ' ')) ) (elec-linefeed (if (eolp) (progn (newline-and-indent)) (progn (elec-indent)) ) ) (elec-semicolon (if (!(eolp)) (end-of-line)) (delete-white-space) (insert-character ';') (newline-and-indent) ) (elec-main next-position old-mode (setq old-mode mode-string) (beginning-of-line) ; put main at margin (delete-white-space) (end-of-line) (insert-string " (){}") dent) (setq next-position (dot)) ) (setq mode-string "if-condition") (recursive-edit) (goto-character next-position) (save-window-excursion (search-forward "}") (setq next-position (dot)) ) (setq mode-string "if-body") (recursive-edit) (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) 0 ) (elec-else next-position old-mode ; insert else construct   (setq old-mode mode-string) (insert-string " {}") (backward-character) (newline-and-indent) (previous-line) (elec-indent) (save-window-excursion (search-forward "}") (setq next-position (dot)) ) (setq mode-string "else-body") (recursive-edit) (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) 0 ) (elec-for next-position old-mode ; insert for constine-and-indent) (previous-line) (elec-indent) (save-window-excursion (search-forward "(") (setq next-position (dot)) ) (setq mode-string "do-body") (recursive-edit) (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (save-window-excursion (search-forward ";") (setq next-position (dot)) ) (setq mode-string "do-condition") (recursive-edit) (goto-character next-position) (newline-and-indent) (ruct (setq old-mode mode-string) (insert-string " (;;) {}") (backward-character) (newline-and-indent) (previous-line) (search-forward "(") (save-window-excursion (elec-indent) (setq next-position (dot)) ) (setq mode-string "for-control") (recursive-edit) (goto-character next-position) (save-window-excursion (search-forward "}") (setq next-position (dot)) ) (setq mode-string "for-body") (recursive-edit) (if (this-line-isetq mode-string old-mode) 0 ) (elec-switch next-position old-mode ; insert switch construct (setq old-mode mode-string) (insert-string " () {}") (backward-character) (newline-and-indent) (previous-line) (search-forward "(") (save-window-excursion (elec-indent) (setq next-position (dot)) ) (setq mode-string "switch-condition") (recursive-edit) (goto-character next-position) (save-window-excursion (search-forward "}") (setq next-ps-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) 0 ) (elec-while next-position old-mode ; insert while construct (setq old-mode mode-string) (insert-string " () {}") (backward-character) (newline-and-indent) (previous-line) (search-forward "(") (save-window-excursion (elec-indent) (setq next-position (dot)) ) (setq mode-string "while-condition") (recursive-edit)osition (dot)) ) (elec-case-loop) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) 0 ) (elec-case next-position old-mode ; single case statment (setq old-mode mode-string) (insert-string " :break;") ; expand case statement (search-reverse "b") (newline-and-indent) (provide-prefix-argument &elec-c-indent-width (insert-character ' ')) (search-reverse ":") ; goto case condition (save-window-excursion ; pre (goto-character next-position) (save-window-excursion (search-forward "}") (setq next-position (dot)) ) (setq mode-string "while-body") (recursive-edit) (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) 0 ) (elec-do next-position old-mode ; insert do construct (setq old-mode mode-string) (insert-string " {} while ();") (search-reverse "}") (newlpare next position (elec-indent) (setq next-position (dot)) ) (setq mode-string "case-condition") (recursive-edit) ; edit case condition (goto-character next-position) (save-window-excursion (search-forward ";") (setq next-position (dot)) ) (setq mode-string "case-body") (recursive-edit) (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (setq mode-string old-mode) 0 ) (elec-case-loop case-col next-p osition old-mode (setq old-mode mode-string) (setq case-col (current-indent)) ; save case column (insert-string "case :break;") ; expand case statement (search-reverse "b") (newline-and-indent) (provide-prefix-argument &elec-c-indent-width (insert-character ' ')) (search-reverse ":") ; goto case condition (save-window-excursion ; prepare next position (elec-indent) (setq next-position (dot)) ) (setq mode-string "case-condition") (recursive-editcter next-position) (setq mode-string old-mode) 0 ) (setup-for-code (setq &elec-c-comment 0) (setq left-margin 0) (setq right-margin 0) (setq prefix-string "") (use-local-map "elec-c-keymap") (setq abbrev-mode 1) ) (elec-slash ; watch for close comment (if (= (preceding-char) '*') (progn (insert-character '/') (pause-or-exit) ) (insert-character '/') ) ) (verbatim old-mode next-position (setq old-mode mode-string) (s) ; edit case condition (while (!= (preceding-char) ' ') (goto-character next-position) ; goto case body (save-window-excursion ; prepare next position (search-forward ";") (newline) (to-col case-col) (setq next-position (dot)) ) (setq mode-string "case-body") (recursive-edit) ; edit body of case (if (this-line-is-blank) (kill-current-line) ) (goto-character next-position) ; find end of case (insert-string "case :break;") ; setup next case (search-etq next-position (dot)) (setq left-margin 0) (setq right-margin 0) ; (setq prefix-string "") (setq abbrev-mode 0) (use-local-map "elec-c-verbatim-keymap") (setq mode-string "verbatim") (message "Type ^C to exit verbatim mode") (recursive-edit) (goto-character next-position) (setq mode-string old-mode) (if &elec-c-comment (setup-for-comment) (setup-for-code) ) ) (setup-for-comment (if (!= (preceding-char) '/') (if (= 0 (setq left-margreverse "b") (newline-and-indent) (provide-prefix-argument &elec-c-indent-width (insert-character ' ')) (search-reverse ":") ; goto case condition (save-window-excursion ; prepare next position (elec-indent) (setq next-position (dot)) ) (setq mode-string "case-condition") (recursive-edit) ; edit case condition ) (delete-previous-word) ; setup for default (insert-string "default") (next-line) (setq mode-string "default") (recursive-edit) in (inside-c-comment))) (setq left-margin (current-column)) ) (setq left-margin (current-column)) ) (setq right-margin &elec-c-right-margin) (if &elec-c-box-comment ; set by inside-c-comment (setq prefix-string "* ") (setq prefix-string &elec-c-comment-prefix) ) (use-local-map "elec-c-comment-keymap") (setq abbrev-mode 0) (setq &elec-c-comment 1) ) (elec-star old-mode ; watch for open comment (if (= (preceding-char) '/') (progn (insert (if (this-line-is-blank) (kill-current-line) ) (setq mode-string old-mode) 0 ) (elec-default next-position old-mode ; case default (setq old-mode mode-string) (insert-string ":break;") (search-reverse "b") (newline-and-indent) (provide-prefix-argument &elec-c-indent-width (insert-character ' ')) (previous-line) (elec-indent) (save-window-excursion (search-forward ";") (setq next-position (dot)) ) (recursive-edit) (goto-chara-character '*') (comment) ) (insert-character '*') ) ) (elec-border old-prefix ; create comment border (if (& &elec-c-comment (= (preceding-char) '*')) (progn (setq right-margin 10000) (provide-prefix-argument &elec-c-border-size (insert-character &elec-c-border-char)) (newline-and-indent) (setq right-margin &elec-c-right-margin) (insert-character '.') (backward-character) (previous-line) (if (= (following-char) '/')   (progn (next-line) (delete-next-character) (insert-string " * ") (setq old-prefix prefix-string) (setq prefix-string "* ")) (= (following-char) '*') (progn (setq prefix-string old-prefix) (next-line) (delete-next-character) (insert-string "*/") (newline) (pause-or-exit)) ) ) (progn (insert-character &elec-c-border-char)) ) ) (comment old-mode ; toggle comment mode manually (if &elec-c-comaren" '(') (local-bind-to-key "elec-linefeed" "\n") (local-bind-to-key "elec-doublequote" """") (local-bind-to-key "elec-singlequote" "'") (local-bind-to-key "elec-right-paren" '}') (local-bind-to-key "elec-right-paren" ')') (local-bind-to-key "elec-right-paren" ']') (local-bind-to-key "elec-semicolon" ';') (local-bind-to-key "elec-star" '*') (local-bind-to-key "elec-tab" "\t") (local-bind-to-key "pause-or-exit" "\^C") (if (error-occurred (use-local-map "elec-c-comment-keymap")) (progn (ment (pause-or-exit) (progn (setq old-mode mode-string) (setq mode-string "comment") (setup-for-comment) (recursive-edit) (setup-for-code) (setq mode-string old-mode) (novalue) ) ) ) (elec-doublequote ; guard quotes against abbrev expansion (insert-string """") (if (! inside-single-quote) (if inside-double-quote (progn (setq inside-double-quote 0) (setq abbrev-mode 1)) (progn (setq inside-double-quote 1) (setq define-keymap "elec-c-comment-keymap") (use-local-map "elec-c-comment-keymap")) ) (local-bind-to-key "elec-slash" '/') (local-bind-to-key "elec-border" &elec-c-border-char) (if (error-occurred (use-local-map "elec-c-verbatim-keymap")) (progn (define-keymap "elec-c-verbatim-keymap") (use-local-map "elec-c-verbatim-keymap")) ) (use-abbrev-table "elec-c-abbrevs") (define-local-abbrev "#d" "#define") (define-local-abbrev "#i" "#include") (define-hooked-local-abbrev "if" "if" "elec-if") abbrev-mode 0)) ) ) ) (elec-singlequote ; guard quotes against abbrev expansion (insert-string "'") (if (! inside-double-quote) (if inside-single-quote (progn (setq inside-single-quote 0) (setq abbrev-mode 1)) (progn (setq inside-single-quote 1) (setq abbrev-mode 0)) ) ) ) (elec-c-mode ; initialize elec-c mode (use-local-map "elec-c-keymap") (use-abbrev-table "elec-c-abbrevs") (setq mode-string "elec-c") (use-syntax-t(define-hooked-local-abbrev "else" "else" "elec-else") (define-hooked-local-abbrev "for" "for" "elec-for") (define-hooked-local-abbrev "while" "while" "elec-while") (define-hooked-local-abbrev "do" "do" "elec-do") (define-hooked-local-abbrev "switch" "switch" "elec-switch") (define-hooked-local-abbrev "case" "case" "elec-case") (define-hooked-local-abbrev "default" "default" "elec-default") (define-hooked-local-abbrev "main" "main" "elec-main") (use-abbrev-table "elec-c-main-abbrevs") (define-hookable "elec-c") ) ) (save-excursion (temp-use-buffer "elec-c buffer") (setq needs-checkpointing 0) (if (error-occurred (use-local-map "elec-c-keymap")) (progn (define-keymap "elec-c-keymap") (use-local-map "elec-c-keymap")) ) (local-bind-to-key "backward-brace" "\e{") (local-bind-to-key "forward-brace" "\e}") (local-bind-to-key "elec-function-format" "\ej") (local-bind-to-key "elec-left-brace" '{') (local-bind-to-key "elec-left-bracket" '[') (local-bind-to-key "elec-left-ped-local-abbrev "argc" "argc" "elec-argc") (use-syntax-table "elec-c") (modify-syntax-entry "w #_") (modify-syntax-entry "(} {") (modify-syntax-entry "(] [") (modify-syntax-entry "() (") (modify-syntax-entry "){ }") (modify-syntax-entry ")[ ]") (modify-syntax-entry ")( )") (modify-syntax-entry " """) ; else forward/backward paren fails (modify-syntax-entry " '") ; else forward/backward paren fails (modify-syntax-entry " {}*/") (modify-syntax-entry "\\ \\") (novalue)   ) ) f (this-line-is-blank) (kill-current-line) ) (goto-character next-position) (newline-and-indent) (setq mode-string old-mode) ) (elec-left-paren next-position ; insert paren pair (insert-string "()") (backward-character) ) (elec-left-bracket next-position ; insert bracket pair (insert-string "[]") (backward-character) ) (elec-right-paren line next-position (insert-character (last-key-struck)) (save-excursion (backward-paren) (if (doerror-occurred8search-reverse/*X<,0"current-columnJv looking-atXconcat/\*(char-to-stringtr|>8search-forward*/ <8backward-bracelevelr  &5 5L: elec-c.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z}L error-message,Can't find end of block!.twhile">:<re-search-reverse[{}]>="following-char{.`"- 2xlR forward-brace>^F V{8P2Can't find beginning of block!5prognV setq-default.&elec-c-split-declarations6(&elec-c-indent-width6x(&elec-c-right-marginK4B&&elec-c-border-char-4&&elec-c-border-sizeKF*&elec-c-comment-prefix 0"&elec-c-comment4d&&elec-c-box-comment40&dv*re-search-forwardv0"preceding-char{ Fb: &~ expand-abbrev"space-position~,insert-character#&backward-character save-window-excursion(goto-character&z* Zprovide-inside-double-quote4&inside-single-quote`declare-buffer-specific8N|N| defunVcurrent-position2+dotinside-c-commentposition  star-position&setq(save-excursionifZprefix-argument(delete-next-character pause-or-exitr|0"recursion-depth pause-emacs exit-emacs, pop-recursionLskip-white-spaceJn&,!eolp.z ft $forward-characterrthis-line-is-blankL$be ginning-of-line>pkill-current-lineF&kill-to-end-of-line\beginning-of-blockmymark& insert-stringh > v,delete-previous-characterV 8V, end-of-blockpreceding-word  backward-word buffer-size *^}d(exchange-dot-and-markr filter-regionindent -st -i~>6 -bc  -nbc @h:/ *0D(Done!,P$:d D elec-linefeed$j set-mark  forward-word$region-to-string jelec-left-brace  next-positionold-mode* mode-string0 bp end-of-linep\,bolp$!=   * @ block-body>{}&newline-and-indentD hTelec-semicolon ;r elec-main .TL8 (){}r>2&)$h .^L.L"main-parametersJuse-abbrev-table&elec-c-main-abbrevs>local-bind-to-key(v"eobp&newlineN<  previous-line elec-indent"recursive-edit6~ Jelec-left-parenx()&Lelec-left-bracket,[]Lelec-right-parenline(f"last-key-struck"backwaelec-c-abbrevs$ vD,T66$main r(  main-body F elec-argc 8,,argv" int argc;&n  char *argv[];nelec-if  () {}rd-paren"dot-is-visibleH Pb"sit-for *pnh messageelec-tabnewcolnh.&&delete-white-space to-colr&elec-function-formatold-dotold-size "*NF<(V@R@,@v  if-condition .$ lf&if-body T  elec-elseLfLZ| {}^$ pj( else-bodyV  delec-forNhN\~" (;;) {}Z f* for-control $ ` ~(~for-body\ ^,x,b4V elec-while 40  |D.߈P| Z> vD6B | &ޜJ@V2   < d( "۬L 86|ގ||Dp(delete-previous-word default next-line6B  elec-defaultݐ"while-conditionf zH$F  <***` while-bodyT0 " zelec-do&  {} while (); .$8 .&Rdo-bodyJ& 2;(,  :break; 8 $ X܊ &(setup-for-codeܴں,ܠ left-margin.t  right-margin,F  prefix-string@ use-local-map  elec-c-keymap, abbrev-mode` elec-slashB do-conditionz \\d8 elec-switch2&H d`: tF0$switch-condition v$t :jX"elec-case-loop V$p$Z, elec-case". :break;@b^*/$/ZverbatimF &4Vڊf~0*elec-c-verbatim-keymapږ@60Type ^C to exit verbatim modeT h6<rD6ڄ0$setup-for-comment(dH޼/8. 4$Tٮڔٜڂz :R<N<.<r"case-condition ($ .`( case-bodyL case-colD^DRt.2"current-indent&b  case :break; p4.ܸX DBߚي֦@׮"l** J."(elec-c-comment-keymap 4x elec-starV ݎ/.$8*comment* elec-border old-prefixX؈ .ۂ* Ԇ'Pz z:`V.tr/Rl * \Jڞڬ*<Ӣݚ ^ݰf z:Hz$݀h6ֲ֠t|novalueelec-doublequoteߊ"zl ԪhZj.rX.D*լ*argc @modify-syntax-entryw #_ (} { (] [ () ( d){ } D)[ ] $)( )  "  '  {}*/ \ \f 0 ) (elec-for next-position old-mode ; insert for constelec-singlequote'zմ Ӿhբ.Ѻ6"L.ьӦ elec-c-mode  *&Ԫelec-c*use-syntax-tableԒBtemp-use-buffer  elec-c buffer4&needs-checkpointingP8H 8D& define-keymap " L: electric-c.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zղ{"X}"z8jX{D[0X( , z D})n];t* t~ Tr6l| x 8  ,/\6   (autoload "edit-block-comment" "comments.ml") (defun (c-paren lastp reindent (if (& (eolp) (= (last-key-struck) '}')) (progn (delete-white-space) (setq lastp (dot)) (setq reindent (bolp)))) (insert-character (last-key-struck)) (save-excursion (backward-paren) (if reindent (progn (save-excursion indent (setq indent (current-indent)) (goto-character lastp) (to-col indent)))) (if (dot-is-visible) (sit-for 5) (progn (beginning-of-liv fVdefine-local-abbrev#d#define8#i#include@define-hooked-local-abbrev *else(forr824(Zdob,2switch*case~xr tne) (set-mark) (end-of-line) (message (region-to-string))) ) ) ) (c-indent old-dot old-size (setq old-dot (+ (dot) 0)) (setq old-size (buffer-size)) (save-excursion (previous-line) (re-search-forward "^}") (set-mark) (backward-paren) (beginning-of-line) (exchange-dot-and-mark) (end-of-line) (forward-character) (filter-region "indent +st") ) (goto-character (/ (* (buffer-size) old-dot) old-size)) (novalue) )  (c-nl-indent indent (setq indent (current-indent)) (delete-white-space) (if (= (preceding-char) '{') (setq indent (+ indent 4))) (newline) (to-col indent) ) (&electric-C-} (if (eolp) (progn (delete-white-space) (if (! (bolp)) (newline)) ) ) (c-paren) ) (&electric-C-{ (if (eolp) (progn (insert-string "{") (newline-and-indent) (indent-line) ) (insert-string "{") ) ) (dedent-line (beginning-of-libind-to-key "&electric-C-*" '*') (local-bind-to-key "&electric-C-/" '/') (local-bind-to-key "high-voltage-off" "\^^") (message "high voltage on") ) (high-voltage-off (local-bind-to-key "self-insert" ';') (local-bind-to-key "self-insert" '{') (local-bind-to-key "c-paren" '}') (local-bind-to-key "self-insert" '*') (local-bind-to-key "self-insert" '/') (local-bind-to-key "high-voltage-on" "\^^") (message "high voltage off") ) (electric-c-mode (setq mode-string "electric-C") (une) (to-col (- (current-indent) 4)) (insert-string ".") (delete-white-space) (delete-previous-character) (end-of-line) ) (indent-line (beginning-of-line) (to-col (+ (current-indent) 4)) (insert-string ".") (delete-white-space) (delete-previous-character) (end-of-line) ) (&electric-C-semi (insert-string ";") (if (eolp) (newline-and-indent)) ) (skip-spaces (forward-character) (while (| (| (= (following-char) ' ') (= (following-char) ' ')) (= (follose-syntax-table "C") (local-bind-to-key "forward-paren" "\e)") (local-bind-to-key "edit-block-comment" "\ee") (local-bind-to-key "backward-paren" "\e(") (local-bind-to-key "begin-C-comment" "\e`") (local-bind-to-key "c-nl-indent" "\n") (local-bind-to-key "c-paren" ')') (local-bind-to-key "c-paren" ']') (local-bind-to-key "c-paren" '}') (local-bind-to-key "end-C-comment" "\e'") (local-bind-to-key "c-indent" "\ej") (local-bind-to-key "high-voltage-on" "") ; CTRL-^ (use-abbrev-table "electwing-char) 10)) (forward-character) ) ) (&electric-C-* (if (& (eolp) (= (preceding-char) '/')) (progn (delete-previous-character) (if (! (bolp)) (progn (delete-white-space) (if (bolp) (delete-previous-character)) ) ) (begin-C-comment) ) (insert-string "*") ) ) (&electric-C-/ (if (& (eolp) (= (preceding-char) '*')) (progn (delete-previous-character) (end-C-comment) ) (inserric-c") (error-occurred (electric-c-mode-hook)) (novalue) ) ) (use-syntax-table "C") (modify-syntax-entry "() (") (modify-syntax-entry ")( )") (modify-syntax-entry "(} {") (modify-syntax-entry "){ }") (modify-syntax-entry "(] [") (modify-syntax-entry ")[ ]") (modify-syntax-entry """ '") (modify-syntax-entry """ """) (modify-syntax-entry "\\ \\") (modify-syntax-entry "w _") (novalue) line(f"last-key-struck"backwat-string "/") ) ) (begin-C-comment (move-to-comment-column) (setq left-margin (current-column)) (setq right-margin 78) (setq prefix-string " ") (insert-string "/* ") ) (end-C-comment (if (!= (preceding-char) ' ') (insert-character ' ')) (insert-character '*') (insert-character '/') (setq right-margin 1000) ) (high-voltage-on (local-bind-to-key "&electric-C-semi" ';') (local-bind-to-key "&electric-C-{" '{') (local-bind-to-key "&electric-C-}" '}') (local- L: electric-c.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z`autoload&edit-block-comment comments.mldefunfc-parenlastpreindentifj&eolp>="last-key-struck}progn&delete-white-space4setqdot$bolp*insert-character4.F,delete-previous-character8D<v  P&electric-C-semiz; skip-spaces&whiler|J0"following-char    &electric-C-* ,>\/^h>0  save-excursion"backward-paren^indent. "current-indent(goto-character to-colz"dot-is-visible"sit-for$beginning-of-lineset-mark end-of-line>message$region-to-stringc-indentJ\"begin-C-comment b~ &electric-C-/^^ n|*,  end-C-comment xX*move-to-comment-columnF left-margin"current-column.H  right-marginN<  prefix-string /* n8$!=H old-dotold-size.X"+V** buffer-size  previous-line:re-search-forward^}>R(exchange-dot-and-markd$forward-character> filter-region indent +st@$:/ *@Tnovalue c-nl-ind */h$ high-voltage-on2local-bind-to-key";v{}*/>$high-voltage-off("high voltage on, self-insert;{}*/r:*$high voltage offentdXxHV0"preceding-char{ 2 newline Fd &electric-C-}>22&! &electric-C-{~4 insert-string{&newline-and-indent indent-line  dedent-liner("-electric-c-modeBj mode-string electric-C8use-syntax-tableC<  forward-paren)"Fe"d0("B`   )]}"'"$jX Buse-abbrev-table electric-cJerror-occurred(electric-c-mode-hookV @modify-syntax-entry() ( )( ) (} { ){ } d(] [ D)[ ] $" ' " " \ \ w _backwaDdefunexpand-mlisp-wordj insert-stringJget-tty-command(: expand-mlisp-word novalueexpand-mlisp-variableVXPget-tty-variable,: expand-mlisp-variable l}progn&delete-white-space4setqdot$bolp*insert-character L: expandX.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z L:generate.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z(defun (expand-mlisp-word (insert-string (get-tty-command ": expand-mlisp-word ")) (novalue)) (expand-mlisp-variable (insert-string (get-tty-variable ": expand-mlisp-variable ")) (novalue)) ) ifj&eolp>="last-key-struck}progn&delete-white-space4setqdot$bolp*insert-character(defun (gen-on (save-excursion fname (setq fname (get-tty-string "function name: ")) (temp-use-buffer "generate") (if prefix-argument-provided (erase-buffer) (progn (end-of-file) (insert-string "\n"))) (insert-string "(defun (" fname "\n") (start-generating-mlisp)))) (defun (gen-off (stop-generating-mlisp) (pop-to-buffer "generate") (end-of-file) (insert-string "))\n") (beginning-of-file) (electric-mlisp-mode))) (bind-to-key "gen-on" "\^X[") (bind-to-key "geE FL: expandX.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zn-off" "\^X]") save-excursion"backward-paren^indent. "current-indent(goto-character to-colz"dot-is-visible"sit-for$beginning-of-lineset-mark end-of-line>message$region-to-stringc-indentg hL:generate.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z; Deletes all lines containing a target string (defun (global-delete-lines target delcnt (setq delcnt 0) (setq target (get-tty-string ": global-delete-lines containing ")) (save-excursion (error-occurred (beginning-of-file) (while 1 (search-forward target) (beginning-of-line) (kill-to-end-of-line) (kill-to-end-of-line) (setq delcnt (+ delcnt 1)) ) ) ) (message (concat delcnt " lines deleted")) ) )  .(defun (0defungen-onsave-excursionfnamebsetqDget-tty-string"function name: >temp-use-buffergenerateif,prefix-argument-provided  erase-bufferjprogn end-of-file4 insert-string .(defun ( L:global-del.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z^*start-generating-mlispgen-off(stop-generating-mlisp& pop-to-buffer\)) $beginning-of-file&electric-mlisp-mode: bind-to-key["]set-mark end-of-line>message$region-to-stringc-indentdefunlglobal-delete-linestargetdelcnt&setqbVget-tty-string4!: global-delete-lines containing .save-excursion error-occurred$beginning-of-filewhile(search-forward$beginning-of-line&kill-to-end-of-line. L:global-del.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z|\"+B\messageBconcat" lines deleted pop-to-buffer\)) $beginning-of-file&electric-mlisp-mode: bind-to-key["]set-mark end-of-line>message$region-to-stringc-indent L:goto.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z7 8L:goto.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z(defun ;*************************************************************** ; goto-line ; - moves cursor to beginning of indicated line. ; - line number is taken from prefix if provided, ; is prompted for otherwise. ; - first line of file is line 1 (goto-line line (if prefix-argument-provided (setq line prefix-argument) (setq line (arg 1 ": goto-line ")) ) (beginning-of-file) (if (> line 1) (provide-prefix-argument (- line 1) (next-line) ) ) (beginnin6defun goto-linelineif,prefix-argument-provided@setq"prefix-argumentJd>arg  : goto-line $beginning-of-file">hprovide-prefix-argument"- next-line$beginning-of-lineg-of-line) (novalue) ) ;*************************************************************** ; goto-percent ; - moves cursor past indicated percentage of the buffer. ; - percentage is taken from prefix if provided, ; is prompted for otherwise. ; - (goto-percent n) goes to the character closest to the ; beginning of the buffer that is reported as n% in the ; status line. This is 2 characters further into the ; buffer than you'd expect. As a result, (goto-percentnovalue, goto-percentpercentZ BT<00p": goto-percent goto-characterp+T/8* buffer-sizedr closest to the ; beginning of the buffer that is reported as n% in the ; status line. This is 2 characters further into the ; buffer than you'd expect. As a result, (goto-percent 0) ; goes to character 1 in the file, since I didn't feel like ; fixing that special case. ; - (goto-percent 100) goes to the end of the buffer. ; - remember that the position of the first character ; in the buffer is 1. (goto-percent percent (if prefix-argument-provided (setq percent prefix-argument) (setq percent (arg 1 ": goto-percent ")) ) (goto-character (+ (/ (* (buffer-size) percent) 100) 2)) (novalue) ) ) novalue c-nl-ind L:incr-search.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z ; 14-Jan-83 Jerry Agin (agin) at Carnegie-Mellon University ; Added regular expression searches. Can be invoked by calling ; incremental-re-search or reverse-incremental-re-search, or by ; typing ^T within a search string. ; Modified: Jerry Agin at CMU-750R Fri Apr 30 1982 ; - fixed case fold lossage ; - added search-exit-char ; Modified: Jeffrey Mogul @ Stanford 6 November 1981 ; - original version tried to reverse by re-defuning things. This ; tended to fail quite often. The direction of search ling (exchange-dot-and-mark))) (s= s1 s2 (setq s1 (arg 1)) (setq s2 (arg 2)) (if (= s1 s2) 1 (!= (length s1) (length s2)) 0 (! case-fold-search) 0 (progn (while (& (length s1) (c= (string-to-char s1) (string-to-char s2))) (setq s1 (substr s1 2 -1)) (setq s2 (substr s2 2 -1))) (! (length s1) )))) (&inc-looking-at ans (if (= string "") 1 is-re (& (! (error-occurred (setq ans (looking-at string)))) ans) (save-excursion (set-mark) is now ; tested explicitly. ; - accepts as a "normal-character" ; A. Witkin 1/81 ; Created. (declare-global I-search-string) (setq I-search-string "") (declare-global I-search-re) (setq I-search-re 0) (declare-global search-exit-char) (if (= search-exit-char 0) (setq-default search-exit-char '\033')) (defun (&inc-initial (if (& (= (length string) 0)(> (length I-search-string) 0)) (progn (setq string I-search-string) (setq is-re I-search-re)))) (&inc-message (message  (goto-character (+ (dot) (length string))) (s= (region-to-string) string)))) (&inc-reverse-check (if (&inc-looking-at string) (progn (setq failing 0) (setq goodlength (length string)) (&inc-message)) (&inc-reverse-search))) (&inc-CG (if (= nextc '') ; ^G (if failing (progn (setq string (substr string 1 goodlength)) (setq failing 0) (&inc-message)) (progn (setq ok 0)(goto-character start))))) (&inc-CS (if (= nextc '') ; ^S (pro(if failing "Failing " "") (if is-forward "" "Reverse ") (if is-re "R-E " "") "I-search: " string)) (&inc-forward-search (setq failing (& (!= string "") (error-occurred (if is-re (re-search-forward string) (search-forward string))))) (if (! failing) (progn (if (= string "") (set-mark) (region-around-match 0) ) (setq goodlength (length string)))) (&inc-message)) (&inc-reverse-search (setq failing (& (!= string "") gn (&inc-initial) (setq is-forward 1) (&inc-forward-search)))) (&inc-CR (if (= nextc '') ; ^R (progn (&inc-initial) (setq is-forward 0) (&inc-reverse-search)))) (&inc-DEL (if (= nextc '') ; RUBOUT (progn (setq string (substr string 1 (- (length string) 1))) (if (& failing (! is-re) (> (length string) goodlength)) ; There's a minor bug here. (Can you find it?) ; It's so obscure it's not worth fixing. (&inc-message) (&inc-check))))) (&inc-CQ (if  (error-occurred (if is-re (re-search-reverse string) (search-reverse string))))) (if (! failing) (progn (set-mark) (setq goodlength (length string)))) (&inc-message)) (&inc-normal-char (setq string (concat string next)) (if (& failing (! is-re)) (&inc-message) (&inc-check))) (&inc-check (if is-forward (&inc-forward-check) (&inc-reverse-check))) (&inc-forward-check (exchange-dot-and-mark) (&inc-forward-search) (if fai(= nextc '') ; ^Q (progn (setq next (char-to-string (setq nextc (get-tty-character)))) (if (&inc-meta-char) (setq next (concat "" next))) (&inc-normal-char) (setq nextc '')))) (&inc-ALT (if (= nextc search-exit-char) (setq ok 0))) (&inc-CT ; use ^T to toggle regular-expression search (if (= nextc '') ; ^T (progn (setq is-re (! is-re)) (&inc-check)))) (&inc-special-char (| (= nextc '')(= nextc search-exit-char) ; ^G (= nextc '')(= nextc '') ; ^S ^R (= nextc '')(= nextc '') ; ^Q RUBOUT (= nextc ''))) ; ^T (&inc-funny-char (| (& (!= nextc ' ') (< nextc ' ')) (> nextc '~'))) ; first is ^I (&inc-meta-char (> nextc 127)) (incremental-search (&incremental-search 1 0)) (reverse-incremental-search (&incremental-search 0 0)) (incremental-re-search (&incremental-search 1 1)) (reverse-incremental-re-search (&incremental-search 0 1)) (&incremental-search string oDdeclare-global"I-search-string2setq$ I-search-re*V$search-exit-charfif"=. setq-defaultdefun &inc-initialf~&Bb4lengthstring(> :Nk start failing is-forward goodlength push-back savemark is-re (setq is-forward (arg 1)) (setq is-re (arg 2)) (if (error-occurred (setq savemark (mark))) (setq savemark 0)) (set-mark) (setq start (dot)) (setq push-back -1) (setq string "") (setq ok 1) (setq failing 0) (setq goodlength 0) (&inc-message) (while ok (&inc-process-char)) (setq I-search-string string) (setq I-search-re is-re) (if (>= push-back 0) (push-back-character push-back)) (set-mark) (goto-character saprogn6$$is-re> &inc-messagemessageBZfailingFailing F is-forward~Reverse *R-E 8 I-search: b&inc-forward-search"!=error-occurred^T*re-search-fovemark) (exchange-dot-and-mark) ) (&inc-process-char next nextc (setq next (char-to-string (setq nextc (get-tty-character)))) (if (&inc-funny-char) (if (&inc-special-char) (progn (&inc-CS)(&inc-CR)(&inc-CG)(&inc-DEL)(&inc-CQ)(&inc-ALT) (&inc-CT)) (progn (setq push-back nextc) (setq ok 0))) (&inc-normal-char)) (if (!= nextc '') (setq I-search-string "")))) Done!,P$:d D elec-linefeed$j rward(search-forward!@bPset-mark.region-around-match0 goodlength b&inc-reverse-search2p|^l2d|^*re-search-reverseD(search-reverse6> $N x&inc-normal-char+ ,L:incr-search.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zDJ8concatnextB8>  &inc-check^XR>&&inc-forward-check&&inc-reverse-checkF(exchange-dot-and-markLps=s1s2*argh.> h r*H$case-fold-searchwhile\< PJc=(string-to-char <0substr|(lvj8 2V&inc-looking-atansZH <660$ looking-atsave-excursionXgoto-cha\incremental-search6&incremental-searchDreverse-incremental-search>incremental-re-searchbFreverse-incremental-re-search"2PHt push-backsavemark4zD*$tmarkPracter6+dot j~0$region-to-stringNVTPj 68z 8&inc-CG&nextc~F&.FH$okdstartZ&inc-CS@ 0$&(~ffZxh6v$0v"(L0$&inc-process-chardzTV$>=^,push-back-character*> 4N$tzXhL"0bXfX,2vd&inc-CR@&$ &inc-DELjznrH<(- B0 P< <T&inc-CQ^Rchar-to-string0b$get-tty-characterF("&inc-meta-charlL&x:,0Bcess-char next nextc (setq next (char-to-string (setq nextc (get-tty-character)))) (if (&inc-funny-char) (if (&inc-special-char) (progn (&inc-CS)(&inc-CR)(&inc-CG)(&inc-DEL)(&inc-CQ)(&inc-ALT) (&inc-CT)) (progn (setq push-back nextc) (setq ok 0))) (&inc-normal-char)) (if (!= nextc '') (setq I-search-string "")))) Done!,P$:d D elec-linefeed$j HH&inc-ALT,vX&inc-CT>fvj$n &inc-special-char|x&inc-funny-charVD<B "<   ~ L:ind-region.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z; This function slides a region left or right by "argument prefix" spaces. ; It is useful in manually meddling with indentation in block-structured ; languages. ; "argument prefix" defaults to 4 if not provided. ; I usually bind it to ESC-^I ; Brian Reid March 82 (defun (indent-region n (if prefix-argument-provided (setq n prefix-argument) (setq n 4)) (if (> (dot) (mark)) (exchange-dot-and-mark)) (beginning-of-line) (exchange-dot-and-mark) ;;;; (end-of-line) (save-excursion defunn indent-regionnif,prefix-argument-provided@setq"prefix-argumenthpnB>dotmark(exchange-dot-and-mark$beginning-of-line save-excursion  narrow-region$beginning-of-filewhile, (narrow-region) (beginning-of-file) (while (! (eobp)) (indent-line n) (next-line) ) (widen-region) ) ) (indent-line (error-occurred (while (looking-at "[ ]") (forward-character)) (if (! (eolp)) (progn oc oq or (setq oc (+ (current-column) (- (arg 1) 1))) (if (< oc 0) (setq oc 0)) (beginning-of-line) (delete-white-space) (setq oq (/ oc 8)) (setq or (- oc (* oq 8))) (while oq !eobp$ indent-line next-line  widen-region"error-occurred`86 looking-at[ ]$forward-characterBeolpdprognocoqor|p+"current-column:-arg (insert-string "\t") (setq oq (- oq 1)) ) (while or (insert-character ' ') (setq or (- or 1)) ) (beginning-of-line) ) (progn (beginning-of-line) (delete-white-space) ) ) ) ) ) 2p|^l2d|^*re-search-reverseD(search-reverse6> $N x&inc-normal-char<H"<,b&delete-white-space.""/:.("*`4 insert-string zF:X<,insert-character "V$N x&inc-normal-char L:ind-region.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z0 0L:info.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z; In the distant past Andy Witkin from SRI wrote an initial ; version of the Info system. This one is a total rewrite ; by James Gosling (5/5/82). Only a few names remain the same. (extend-database-search-list "info" "/emacs/databases/info") (setq-default info-root-file "dir") (setq-default &info-file info-root-file) (setq-default &info-node "Top") (setq-default &info-camefrom "") (setq-default &info-doedit 0) (defun (info (&info "dir" "top"))) (defun (describe-command (&info "emacs" (get-tty-commsetq key (region-to-string)) (erase-region) (put-database-entry "info" key))) (setq mode-line-format " INFO Node: %m %M %p %") ) ) (defun (#info-g fn m s (setq s (get-tty-string "Node: ")) (setq m "Top")(setq fn 0) (save-excursion (temp-use-buffer "Hack Buffer") (setq needs-checkpointing 0) (setq case-fold-search 1) (erase-buffer) (use-syntax-table "info-syntax-table") (insert-string s) (beginning-of-line) (get-node-and-file) ) and ": describe-command ")))) (defun (describe-variable (&info "emacs" (get-tty-variable ": describe-variable ")))) (defun (&info m fn i (setq fn (arg 1)) (setq m (arg 2)) (save-window-excursion (delete-other-windows) (temp-use-buffer "*info-stack*") (erase-buffer) (switch-to-buffer "INFO") (setq &info-camefrom "") (find-node) (if (is-bound &info-running) (message "Recursive INFO call punted.") (progn &info-running ( (find-node)) ) (defun (#info-h fn m (setq fn "info") (setq m "help") (find-node)) ) (defun (#info-hlp fn m (setq fn "cmds") (setq m "top") (find-node)) ) (defun (#info-d fn m (setq &info-camefrom "") (setq fn info-root-file) (setq m "Top") (find-node)) ) (defun (#info-l fn m dot (save-excursion (temp-use-buffer "*info-stack*") (end-of-file) (re-search-reverse ";\\(\\w\\w*\\),\\(\\w\\w*\\),\\(\\w\\w*\\);") (region-around-mmessage "Type '^C' to resume editing, 'h' for help with INFO") (sit-for 0) (message "Type '^C' to resume editing, 'h' for help with INFO") (recursive-edit))) ) ) ) (defun (#info-enable-edit (setq &info-doedit 1) (local-bind-to-key "#info-^r" "\e\^e") (message "Database editing enabled"))) (defun (#info-^r setting-up-for-edit fn m (setq fn &info-file) (setq m &info-node) (find-node) (use-local-map "&info-editing") (setq mode-line-format (concat " atch 1) (setq dot (region-to-string)) (region-around-match 2) (setq fn (region-to-string)) (region-around-match 3) (setq m (region-to-string)) (region-around-match 0) (end-of-file) (erase-region) ) (setq &info-camefrom "") (find-node) (goto-character dot)) ) (defun (#info-@ path m (setq path (get-tty-string "Path: ")) (save-excursion (temp-use-buffer "Hack Buffer") (erase-buffer) (insert-string path " ") (beginning-of-file) (while (! (error-occurr INFO edit File: " &info-file " Node: " &info-node " %M %[%p%]")) (message "Type ^C to resume info") (use-syntax-table "text-mode") (save-excursion (recursive-edit)) (use-syntax-table "info-syntax-table") (use-local-map "&info-commands") (if (& buffer-is-modified (= (substr (get-tty-string "Save changes? ") 1 1) "y")) (progn key (beginning-of-file) (set-mark) (insert-string &info-file ":" &info-node) (case-region-lower) (ed (temp-use-buffer "Hack Buffer") (re-search-forward "[ ]*\\(.[^ ]*\\)"))) (region-around-match 1) (setq m (region-to-string)) (if (error-occurred (temp-use-buffer "INFO") (&info-goto-menu-item)) (error-message "No such menu item: " m))) ) (beginning-of-file)) ) (defun (#info-m m (setq m (get-tty-string "Menu item: ")) (&info-goto-menu-item)) ) (defun (#info-mouse-menu ldot (move-dot-to-mouse) (setq ldot (dot)) (beginning-of-line) (if (bobp) (progn (set-mark) (end-of-line) (narrow-region) (goto-character ldot) (re-search-reverse "[\t,:]") (search-forward ":") (widen-region) (get-node-and-file) (find-node) ) (if (looking-at "^* \\(\\w*\\):") (progn (re-search-forward "") (if (= (following-char) ':') (progn (setq fn "") (region-around-match 1) (setq m (region-to-string))) (get-node-and-file)) (setq &info-camefrom " Up: ") (find-node)) (error-me fn (setq m "Top") (beginning-of-file) (end-of-line) (if (error-occurred (re-search-reverse "Prev[ious]*:")) (error-message "This node has no previous.")) (search-forward "") (get-node-and-file) (setq &info-camefrom " Next: ") (find-node)) ) (defun (#info-n m fn (setq m "Top") (beginning-of-file) (end-of-line) (if (error-occurred (search-reverse "Next:")) (error-message "This node has no next.")) (search-forward "") ssage "No menu item on this line")) )) ) (defun (&info-goto-menu-item fn (if (error-occurred (beginning-of-file) (search-forward (concat (char-to-string 13) "* menu:"))) (error-message "This node has no menu.")) (if (error-occurred (re-search-forward (concat "^* \\(" m "\\w*\\):"))) (error-message "No such menu item: " m)) (if (= (following-char) ':') (progn (setq fn "") (region-around-match 1) (setq m (region-to-string))) (get-node-and-file)) (setq (get-node-and-file) (setq &info-camefrom " Previous: ") (find-node)) ) (defun (#info-u m fn (setq m "Top") (beginning-of-file) (end-of-line) (if (error-occurred (search-reverse "Up:")) (error-message "This node has no up.")) (search-forward "") (get-node-and-file) (find-node)) ) (defun (find-node dot sav file (setq dot (dot)) (setq sav 0) (if (error-occurred key keyc (switch-to-buffer "INFO") (erase-buffer) (set-mark) (insert-string (if (= ""  &info-camefrom " Up: ") (find-node)) ) (defun (get-node-and-file (if (looking-at "[ ]*(\\(\\w*\\))[ ]*\\(\\w*\\)") (progn (region-around-match 1) (setq fn (region-to-string)) (region-around-match 2) (if (| (= fn "dir") (= fn "Dir") (= fn "DIR")) (setq fn info-root-file)) ) (looking-at "[ ]*\\(\\w*\\)") (progn (region-around-match 1) (setq fn "") ) (error-message "Missing node specification.") ) (setq m (region-to-strfn) &info-file fn) ":" m) (setq keyc (region-to-string)) (case-region-lower) (setq key (region-to-string)) (erase-buffer) (if (error-occurred (fetch-database-entry "info" key)) (fetch-database-entry "info" keyc)) ) (progn (switch-to-buffer "INFO") (if (& &info-doedit (= (substr (progn (get-tty-string "Not found, should I create it? ")) 1 1) "y")) (&info-make-node) (progn lfn lm (setq lfn fn) (setq lm m) (error-occurred ing)) (if (= m "") (setq m "top")) ) ) (defun (#info-f m fn (setq m (get-tty-string "Footnote: ")) (save-excursion (beginning-of-file) (if (error-occurred (re-search-forward (concat "*note \\(" m "\\w*\\):"))) (error-message "No such footnote: " m)) (if (= (following-char) ':') (progn (setq fn "") (region-around-match 1) (setq m (region-to-string))) (get-node-and-file)) ) (setq &info-camefrom "") (find-node)) ) (defun (#info-p m (if (& (!= &info-node m) (| (= fn "") (!= &info-file fn))) (progn (setq fn &info-file) (setq m &info-node) (find-node)))) (error-message "No information on (" (if (= lfn "") &info-file lfn) ") " lm) ))) ) (if (!= fn "") (setq &info-file fn)) (setq &info-node m) (setq mode-string m) (temp-use-buffer "*info-stack*") (end-of-file) (insert-string ";" (+ dot 0) "," &info-file "," &info-node) (switch-to-buffer "INFO") (beginning-of-file) (if (& (! (is-bound setting-up-for-edit)) (looking-at " *execute: *<<")) (progn (search-forward "") (set-mark) (search-forward ">>") (backward-character) (backward-character) (narrow-region) (execute-mlisp-buffer))) (setq mode-line-format " INFO Node: %m %M %p") ) ) (defun (convert-ITS-info-file fn (setq fn (current-buffer-name)) (beginning-of-file) (setq case-fold-search 1) (error-occurred (while 1 (progn node HasCode fer "*info-stack*") (setq needs-checkpointing 0) (use-syntax-table "info-stack-syntax-table") (modify-syntax-entry "w -~") (modify-syntax-entry " ,") (erase-buffer) (temp-use-buffer "INFO") (setq needs-checkpointing 0) (define-keymap "&info-editing") (use-local-map "&info-editing") (local-bind-to-key "exit-emacs" "\^]") (local-bind-to-key "exit-emacs" "\^X\^S") (local-bind-to-key "justify-paragraph" "\ej") (setq right-margin 77) (define-keymap  (re-search-forward "\^_\^_*\\|\^L") (setq HasCode (= (preceding-char) '^L')) (re-search-forward "[\^_\^L\n\t ]*") (set-mark) (if HasCode (re-search-forward "\^_[\^_\^L\n\t ]*")) (save-excursion (if (! (looking-at ".*node: *\\([^,\n\t]*\\)")) (error-message "bad format")) (region-around-match 1) (case-region-lower) (setq node (region-to-string)) (beginning-of-line) (if (looking-at ".*file:[ \t]*\\([^, \t\n]*\"&info-commands") (use-local-map "&info-commands") (setq case-fold-search 1) (use-syntax-table "info-syntax-table") (modify-syntax-entry "w -~") (modify-syntax-entry " .,:") (setq c 0) (while (<= c 0177) (local-bind-to-key "illegal-operation" c) (setq c (+ c 1))) (local-bind-to-key "execute-extended-command" 'x') (local-bind-to-key "search-forward" 's') (local-bind-to-key "search-forward" "\^s") (local-bind-to-key "search-reverse" 'r') (loc\)") (progn (region-around-match 1) (case-region-lower) (setq fn (region-to-string)))) ) (re-search-forward "\^L\\|\^_\\|\\'") (if (! (eobp)) (backward-character)) (copy-region-to-buffer "INFO") (save-excursion (temp-use-buffer "INFO") (put-database-entry "info" (concat fn ":" node)) ) (message "Wrote " fn ":" node) (sit-for 0) ))) ) ) (defun (&info-make-node (switch-tal-bind-to-key "search-reverse" "\^r") (local-bind-to-key "redraw-display" "\^l") (local-bind-to-key "#info-@" "@") (local-bind-to-key "scroll-one-line-down" "a") (local-bind-to-key "scroll-one-line-up" "z") (local-bind-to-key "scroll-one-line-up" "\^z") (local-bind-to-key "#info-hlp" "?") (local-bind-to-key "exit-emacs" "q") (local-bind-to-key "exit-emacs" "\^C") (local-bind-to-key "#info-m" "m") (local-bind-to-key "#info-n" "n") (local-bind-to-key "#o-buffer "INFO") (erase-buffer) (insert-string "File: " &info-file " Node: " m) (if (!= &info-camefrom "") (progn (insert-string &info-camefrom) (if (!= fn "") (progn (insert-string "(" &info-file ")") )) (insert-string &info-node) )) (insert-string "\n\n[body]\n\n* menu:\n") (search-reverse "[") (if (!= fn "") (setq &info-file fn)) (setq &info-node m) (#info-^r) ) ) (save-excursion c (temp-use-bufinfo-p" "p") (local-bind-to-key "#info-f" "f") (local-bind-to-key "#info-u" "u") (local-bind-to-key "next-page" " ") (local-bind-to-key "next-page" "\^v") (local-bind-to-key "previous-page" "\^h") (local-bind-to-key "beginning-of-file" "b") (local-bind-to-key "end-of-file" "e") (local-bind-to-key "#info-mouse-menu" "\ePA1D") (local-bind-to-key "#info-mouse-menu" "\ePB1D") (local-bind-to-key "#info-l" "l") (local-bind-to-key "#info-d" "d") (local-bind-to-key "#info-h" "h") (local-bind-to-key "#info-g" "g") (local-bind-to-key "#info-enable-edit" "\e\") (local-bind-to-key "execute-extended-command" ":") ) (novalue)  z D})n];t* t~ Tr6l| x 8  ,/\6   -use-buffer  *info-stack*  erase-buffer<switch-to-bufferINFO find-nodeTif<is-bound  &info-runningHmessage.Recursive INFO call punted.prognLF3Type '^C' to resume editing, 'h' for help with INFO"sit-for 0"recurs-U -VL:info.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zive-edit#info-enable-edit8Vlocal-bind-to-key#info-^r2n,Database editing enabled&setting-up-for-edit: (l@ use-local-map  &info-editing$mode-line-formatconcat( INFO edit File:  Nnextend-database-search-listinfo(/emacs/databases/infoX setq-default"info-root-filedir* &info-file: &info-nodeTop<H"&info-camefrom.  &info-doeditRdefun:4&infotopode:   %M %[%p%]0*Type ^C to resume info@use-syntax-table text-mode(save-excursion.*$info-syntax-table(N"&info-commands&&buffer-is-modified=nsubstrDget-tty-string"Save changes? yBhdescribe-commandfemacsHget-tty-command&: describe-command "|describe-variableXtLget-tty-variable(: describe-variable  mfni<setqargpsave-window-excursion(delete-other-windowsBtempkey$beginning-of-fileset-mark@ insert-stringj:z$case-region-lower0D$region-to-string  erase-region2put-database-entryNNB. INFO Node: %m %M %p %#info-ghs, Node: `&N$ Hack Buffer4&needs-checkpointing2$case-fold-search $ $beginning-of-line$get-node-and-filehb#info-h$help2j(d #info-hlpp$xcmds@hb#info-d"following-char:8*`( Up: 2,No menu item on this linevpJ\&PdJ*char-to-string * menu:0V*This node has no menu.bNJLDt>(^* \(n\w*\):BX*:8lZ*^"@(D.n`V#info-ldot  b~ end-of-fileVre-search-reverse2;\(\w\w*\),\(\w\w*\),\(\w\w*\);.region-around-match4vV6@(goto-character#i:" Ff\lp2Z,[ ]*(\(\w*\))[ ]*\(\w*\)hj|H"x6Dir"VDIR"b$r [ ]*\(\w*\)&4.Missing node specification.N*6~h$JDnfo-@path,$ XPath: P   Lwhile!terror-occurred <Fre-search-forward"[ ]*\(.[^ ]*\) tl:j (&info-goto-menu-itemL error-message&No such menu item: 62\V#info-m#info-f0*$^ Footnote: Rr`:^4.:*note \(|2&No such footnote: DX,:8n\,`<$ (h^#info-phf4,2&(  Prev[ious]*:4.This node has no previous. df* 0B$v Menu item: 4^#info-mouse-menuldot$move-dot-to-mouse bobp|R end-of-line  narrow-region B[ ,:](search-forward  widen-regionP(< looking-at ^* \(\w*\):r jt0`J2 Next: vl#info-nvvB@@:search-reverseNext:0*This node has no next. bd.H0" Previous: pf#info-upV<":Up:.(This node has no up. |~VP|savfileB< hfkeyc 6$ r fF~f<R:4fetch-database-entry" \l`T>82Not found, should I create it? "&info-make-nodePb.copy-region-to-bufferL6r ߺ:$Z2Wrote ޚP(xr* ߠ߾tJFile:  Node: ߮L:p0 "R߄":4(d) n,& [body] * menu: [*~8lVlfnlm$vlR"!=*D8~0lF2l&No information on ($RD) *xr* mode-stringh Fbb;"+ DZ c ݸ0 *info-stack-syntax-tableBmodify-syntax-entryw -~  ,H ݀NB& define-keymap. "8  exit-emacs"@޲$justify-paragraphj.n  right-margin, 4R@p (^" *execute: *<< >>&backward-character2(execute-mlisp-buffer@Fz4! INFO Node: %m %M %pbX\convert-ITS-info-file2&current-buffer-named~nodeM   ((P , Jj"> .,:z$<=0ݠ$illegal-operationP lD8:P,execute-extended-commandxs r <ܮ"redraw-display r@BRHasCode *\| <0 "preceding-char "[ ]*.(`"N [ ]*^4.(.*node: *\([^, ]*\)$ bad formatZxvdj2T,.*file:[ ]*\([^, ]*\),ߦv"8 \|\|\'*eobp(scroll-one-line-downa@&scroll-one-line-upz  ۰? ېq phP >$n p f u(ھ next-page ږ:v  previous-page <b fe$PA1D$PB1D ٴl ٔ(d t6h Tވg4h"<novalueey "exit-emacs" "q") (local-bind-to-key "exit-emacs" "\^C") (local-bind-to-key "#info-m" "m") (local-bind-to-key "#info-n" "n") (local-bind-to-key "#ing-char) '?'))) (insert-string " ")) (insert-string " ") ) (if (bolp) (backward-character)) (setq c-col (current-column)) (while (progn (setq last-col c-col) (insert-character '!') (delete-previous-character) ; (beginning-of-line) ; (if (= (following-char) '@') ; (insert-character ' ')) ; (end-of-line) (setq c-col (current-column)) (< c-col last-col)) (novalue)) ) ) ) (message "Done!") (novalue   L:justify.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z) ) ) ) #info-enable-edit8Vlocal-bind-to-key#info-^r2n,Database editing enabled&setting-up-for-edit: (l@ use-local-map  &info-editing$mode-line-formatconcat( INFO edit File:  N; Paragraph justification routines ; James Gosling (declare-buffer-specific paragraph-indent) (if (! (is-bound paragraph-indent)) (setq-default paragraph-indent 0)) (defun (justify-paragraph (error-occurred (save-excursion (beginning-of-line) (while (& (! (bobp)) (! (eolp)) (!= (following-char) '@')) (progn (previous-line)(beginning-of-line))) (if (| (eolp) (= (following-char) '@')) (progn (next-line)(beginning-of-line))) (if (& (! (eolp)) (!= (fol L:justify.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zlowing-char) '@')) (progn last-col c-col (delete-white-space) (to-col (+ left-margin paragraph-indent)) (if (= (following-char) '@') (insert-character ' ')) (while (progn (end-of-line) (if (! (eobp)) (forward-character)) (& (! (eolp)) (!= (following-char) '@'))) (delete-previous-character) (delete-white-space) (if (& (< (preceding-char) '@') (| (= (preceding-char) '.') (= (preceding-char) '!') (= (precedNdeclare-buffer-specific$paragraph-indentzif6!"is-bound. setq-defaulttdefunjustify-paragrapherror-occurredDsave-excursion$beginning-of-linewhile&bobpeolp@!="following-char@>progn  previous-linej<|T"=h@( next-line& @0last-colc-col&delete-white-spaceRto-col8+ left-marginFH@,insert-character 2 ; killring.ml: kill and unkill text a la TOPS-20 ; HISTORY: ; 08-Dec-82 Jerry Agin (agin) at Carnegie-Mellon University ; Made some of Duane's code more efficient. ; Killing no longer moves the mark (but copying lines and ; unkilling still do). ; 03-Dec-82 Duane Williams (dtw) at Carnegie-Mellon University ; Fixed bug in forward-lines so that kill-lines works properly on ; empty lines when &kill-lines-magic is 1 and user tracks eol on ; ^N-^P. Also added kill-character and backward-kill-character, ; end-of-lineHHXeobp$forward-character&6 bt@,delete-previous-character><"preceding-char@Bh|.h!T?4 insert-string Dbolp&backward-character@setq<"current-columnp and made kill-region warn the user when killing a large region. ; 28-Jul-82 Jerry Agin (agin) at Carnegie-Mellon University ; Moved the binding of append-next-kill from esc-a to ; esc-^W to avoid a conflict with backward-sentence. ; 14-Jul-82 Jerry Agin (agin) at Carnegie-Mellon University ; Created. ; This emacs macro file defines commands for killing and unkilling text. ; Commands to delete words, lines, and regions actually send the text to a ; ring of killbuffers, where they can be yanked back. MulvP!V|novalue2messageDone!,Database editing enabled&setting-up-for-edit: (l@ use-local-map  &info-editing$mode-line-formatconcat( INFO edit File:  Ntiple killing ; commands in succession will concatenate text to the same buffer, so a ; single unkill can bring it all back. The unkill-pop command can cycle ; the kill ring to retrieve previously-killed stuff. ; The following keys are redefined: ; ^W kill-region ; ESC-w copy-region ; ^K kill-lines ; ESC-k copy-lines ; ESC-d kill-word ; ESC-h backward-kill-word ; ESC-del backward-kill-word ; ^D kill-character ; ^H backward-kill-character ; ^? backward-kill-character ; ESC-^W append next kill ( L:killring.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zpretend previous command was ^K) ; ^Y unkill ; ESC-y unkill-pop (kill the region, back up one on the kill ring, ; and unkill) ; Options: ; There are usually four buffers in the killring. If you want more buffers ; in the ring (say 8), execute the following mlisp functions BEFORE you load ; this file: ; (setq-default nrings 8) ; or else execute the following AFTER you load this file: ; (set-nrings 8) ; The ^K function will behave pretty much the same as the old ; delete-to-end-of-line did, unless you want something better. The improved ; version bases its behavior on the horizontal position of the cursor at the ; time the command is issued. If the cursor is at the beginning of the line, ; the command will assume you want to kill the entire line, including the ; return at the end. If you're at the end of the line, then it will remove ; the return separating this line from the next. Otherwise, it will kill ; just to the end of the line. To get this all to happen, execute the ; following mlisp fun-region-to-buffer killbuffer) (previous-killbuffer) ) ) (unkill) ) (set-up-killbuffer (setq killbuffer (concat "KB-" ringpos))) (next-killbuffer (setq ringpos (+ ringpos 1)) (if (> ringpos nrings) (setq ringpos (- ringpos nrings))) (set-up-killbuffer)) (previous-killbuffer (setq ringpos (- ringpos 1)) (if (< ringpos 1) (setq ringpos (+ ringpos nrings))) (set-up-killbuffer)) (forward-lines (if (& &kill-lines-magic (bolp)) (if (error-occurred ; beginning ction: ; (setq-default &kill-lines-magic 1) ; The variable &MaxKillSize is initialized to a value of zero. If you set ; it to a value such as 400 with the call ; (setq-default &MaxKillSize 400) ; then any kill function will ask the user for confirmation if the region ; being killed exceeds the size specified. (defun (region-size val (setq val (- (dot) (mark))) (if (>= val 0) val (- 0 val) ) ) (kill-region (if (| (<= &MaxKillSize 0) (<= (region-size) &MaxKillSize) of line--kill whole lines (prefix-argument-loop (search-forward "\n")) ) (end-of-file) ) (error-occurred (prefix-argument-loop (if (eolp) (forward-character) ; end of line--kill crlf (end-of-line)))))) ; else--kill to end of line (kill-lines ; to append to killbuffer, set dot before killing (save-excursion (set-mark) (provide-prefix-argument prefix-argument (forward-lines)) (kill-region))) (copy-lines (set-mark) (provide-prefix-argument prefix-arg (= (substr (get-tty-string (concat "Do you really want to kill " (region-size) " characters? [no] ")) 1 1) "y") ) (progn (if (= (previous-command) -11) (progn (c-append-region) (erase-region)) (progn (next-killbuffer) (delete-region-to-buffer killbuffer))) (setq this-command -11) ) (setq this-command (previous-command)) ) ) (copy-region (if (= (previous-command) -11) (c-append-region) (progn (nument (forward-lines)) (copy-region)) (kill-word (save-excursion (set-mark) (provide-prefix-argument prefix-argument (forward-word)) (kill-region))) (backward-kill-word (save-excursion (set-mark) (provide-prefix-argument prefix-argument (backward-word)) (kill-region))) (kill-character (save-excursion (set-mark) (provide-prefix-argument prefix-argument (forward-character)) (kill-region))) (backward-kill-character (save-excursion (set-markext-killbuffer) (copy-region-to-buffer killbuffer))) (setq this-command -11)) (c-append-region (if (>= (dot) (mark)) (append-region-to-buffer killbuffer) (progn (exchange-dot-and-mark) (yank-buffer killbuffer) (copy-region-to-buffer killbuffer)))) (append-next-kill (setq this-command -11)) (unkill ; leaves region around restored text (set-mark) (yank-buffer killbuffer) (setq this-command -25) ) (unkill-pop (if (= (previous-command) -25) (progn (delete) (provide-prefix-argument prefix-argument (backward-character)) (kill-region))) ) (declare-global nrings) (if (= nrings 0) (setq-default nrings 4)) (declare-global ringpos) (declare-global killbuffer) (if (! (is-bound &kill-lines-magic)) (setq-default &kill-lines-magic 0)) (if (! (is-bound &MaxKillSize)) (setq-default &MaxKillSize 0)) (defun (set-nrings (save-excursion (setq nrings (arg 1 "Number of kill rings: ")) (setq ringpos (+ nrings 1)) (while (> ringpos 1) (setq ringpos (- ringpos 1)) (set-up-killbuffer) (temp-use-buffer killbuffer) (setq needs-checkpointing 0) ) ) ) ) (set-nrings nrings) (bind-to-key "kill-region" "") ; ^W (bind-to-key "copy-region" "w") ; ESC-w (bind-to-key "copy-region" "W") ; ESC-W (bind-to-key "kill-lines" " ") ; ^K (bind-to-key "copy-lines" "k") ; ESC-k (bind-to-key "copy-lines" "K") ; ESC-K (bind-to-key "kill-word" "d") ; ESC-d (bind-to-key "kill-word" "D") ; ESC-D (bind-to-key "backward-killDo you really want to kill & characters? [no] y6progn(2$previous-commandH"c-append-region  erase-regionpl"next-killbufferHdelete-region-to-buffer killbuffer.  this-command copy-regionZ:~-word" "h") ; ESC-h (bind-to-key "backward-kill-word" "H") ; ESC-H (bind-to-key "backward-kill-word" "") ; esc rubout (bind-to-key "kill-character" "") ; ^D (bind-to-key "backward-kill-character" "") ; ^H (bind-to-key "backward-kill-character" "") ; rubout (bind-to-key "append-next-kill" "") ; ESC-^W (bind-to-key "unkill" "") ;^Y (bind-to-key "unkill-pop" "y") ; ESC-y (bind-to-key "unkill-pop" "Y") ; ESC-Y (This node has no up. |~VP|.copy-region-to-buffer4 Lfv,<0append-region-to-buffer^(exchange-dot-and-mark$ yank-buffer "t8append-next-kill<hVunkillset-mark fv unkill-popR8 x&previous-killbuffer>f L:killring.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zset-up-killbufferB8@6KB-ringpos."+X"4>nringsvjr ^Lp@F"<*` forward-linesf2P&$&kill-lines-magicbolperror-occurred^ 0defun region-sizeval`setqB-dotmarkTif$>=bT@ kill-regionL|><=  &MaxKillSize=substrget-tty-stringtconcat.prefix-argument-loop6search-forward  end-of-filelff`,eolp$forward-character end-of-line kill-linessave-excursion"Rprovide-prefix-argument"prefix-argument< copy-linesZ kill-word>,f,Hl  forward-worddbackward-kill-word>,  backward-wordFkill-character$hHnbackward-kill-characterDT26Z&backward-character(declare-global`HX.N. setq-default   P6!"is-bound; Package for the emacs tutorial (defun (learn (save-window-excursion (delete-other-windows) (switch-to-buffer "emacs-tutorial") (erase-buffer) (insert-file "/emacs/databases/tutorial.txt") (setq needs-checkpointing 0) (recursive-edit) ) )) l-regionL|><=  &MaxKillSize=substrget-tty-stringtconcat., 8V,LF set-nrings(TNHarg*Number of kill rings: whileT R@d4(temp-use-buffer4&needs-checkpointing ,8 bind-to-keyZ"w" L:learn.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zW  "hXk"F6K"$Pd".D"fh"DH"" zd Z :j"x "y"Ytedefunlearnlsave-window-excursion(delete-other-windowsFswitch-to-buffer"emacs-tutorial  erase-bufferN insert-file0/emacs/databases/tutorial.txtFsetq&needs-checkpointing"recursive-editsubstrget-tty-stringtconcat. L:learn.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z L:lines.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z (defun (display-line-number orig page line pagetop (save-excursion (setq orig (dot)) (beginning-of-file) (setq page 1) (setq pagetop (dot)) (while (& (! (error-occurred (search-forward " "))) ;^L (<= (dot) orig)) (setq page (+ page 1)) (setq pagetop (dot)) ) (goto-character pagetop) (setq line 1) (while (& (! (error-occurred (search-forward "\n"))) (<= (dot) orig)) (setq line (+ line 1)) ) ) (message "Line " line (if (> pageZ"+@\(goto-character.d d>&  46  DLmessageLine fif"><concat in page , "-  of  bu 1) (concat " in page " page) "" ) ", " (- (dot) 1) " of " (buffer-size) " characters" ) ) (beginning-of-next-line (if (error-occurred (prefix-argument-loop (search-forward "\n"))) (end-of-file))) )  erase-regionpl"next-killbufferHdelete-region-to-buffer killbuffer.  this-command copy-regionZ:~ffer-size charactersbeginning-of-next-line^:.4prefix-argument-loop " end-of-fileange-dot-and-mark$ yank-buffer "t8append-next-kill<hVunkillset-mark fv unkill-popR8 x&previous-killbuffer>f L:lines.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z L:lisp.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zdefundisplay-line-numberorigpagelinepagetop:save-excursion4setqhdot$beginning-of-file:Vwhile&l!Xerror-occurred6search-forward "<=N. (defun (paren-pause dot instabs temp (if (eolp) (delete-white-space)) (setq instabs (bolp)) (setq dot (dot)) (insert-character ')') (save-excursion (if (| (error-occurred (setq temp (ucb-backward-paren))) (! temp)) (message "Can't find balancing paren") (progn (if instabs (save-excursion descol (setq descol (current-column)) (goto-character dot) (to-col descol))) (if (dot-is-visible) (sit-for 5) (progn (beginning-of-line) (set-mark) (end-of-line) (message (region-to-string)) ) ) ) ) ) ) (nl-indent col dot bal (delete-white-space) (setq dot (dot)) (setq col (current-indent)) (save-excursion (beginning-of-line) (while (< (current-column) col) (forward-character)) (if (looking-at "elseif") (re-indent-thenelse 1) (| (looking-at "then") (looking-at "else")) (re-indent-thenelse 3))) (save-excursion (if (setq bal (ucb-backward-balanced-beginning-of-line) (delete-white-space) (if (looking-at "elseif") (re-indent-thenelse 1) (| (looking-at "then")(looking-at "else")) (re-indent-thenelse 3) (! (bobp)) (progn (backward-character) (nl-indent) (delete-next-character)))) (indent-sexpr start end (save-excursion (if (! (= (following-char) '(')) (error-message "Not sitting on left parenthesis") (progn (setq start (dot)) (ucb-forward-paren) (end-of-line) (setq end (dparen-line)) ; bal = 1 means hit beginning of line with ; paren count = 0; ; bal = -1 means hit too many left parens (progn (if (= bal -1) (if (bolp) (setq col 4) (progn (setq col (current-column)) (forward-character) (if (= (following-char) '(') (setq col (+ col 1)) (| (looking-at "prog ") (looking-at "let") (looking-at "bind") (looking-at "lambda") (looking-at "caseq")) (setq col (+ col 3)) (ot)) (goto-character start) (next-line) (while (& (! (eobp)) (<= (dot) end)) (re-indent-line) (next-line) (if (! (eobp)) (beginning-of-line))))))) (indent-lisp-function (save-excursion (if (error-occurred (re-search-reverse "^(def")) (error-message "Can't find function")) (indent-sexpr) (message "Done!"))) (re-indent-funcs arg (progn (setq arg (get-tty-character)) (if (= arg '=') (re-indent-line) (= arg progn (use-syntax-table "wordall") (forward-skip-word) (forward-skip-non-word) (use-syntax-table Current-syntax-table) (if (| (> (dot) dot) (= (following-char) ';')) (setq col (+ col 3)) (setq col (current-column))))))) ; bal = 0 so we are at line with matching ; paren or on same line if no parens (progn (setq col (current-indent)) (while (< (current-column) col) (forward-character)) '%') (indent-sexpr) (= arg 'f') (indent-lisp-function) (error-message "Bad = option")))) (back-function (re-search-reverse "^(de")) (forw-function (re-search-forward "^(de")) (forward-sexpr (search-forward "(") (ucb-forward-paren)) (backward-sexpr (search-reverse ")") (ucb-backward-paren)) (semi-colon-comment (if (eolp) (progn (if (! (bolp)) (to-col comment-column)) (setq left-margin comment-column) (setq right-margin 77) (setq  (if (| (looking-at "then") (looking-at "else")) (setq col (+ col 5)))))))) (newline) (to-col col)) ; arg 1 is amount past "(If" to skip (re-indent-thenelse col (set-mark) (setq col (current-indent)) (insert-character ')') (if (ucb-backward-paren) (progn (if (| (looking-at "(If") (looking-at "(if")) (setq col (+ (current-column) (arg 1)))))) (goto-character (mark)) (delete-next-character) (delete-white-space) (to-col col)) (re-indent-line (prefix-string "; ") (insert-string "; ")) (insert-character ';')) ) (ml-paren ; may be bound to the left paren "(" ; for mlisp command expansion (insert-character '(') (insert-string (get-tty-command " (")) (insert-character ' ') (novalue)) (lisp-mode (local-bind-to-key "paren-pause" ')') (local-bind-to-key "forward-paren" "\e)") (local-bind-to-key "backward-paren" "\e(") (local-bind-to-key "nl-indent" "\n") (local-bind-to-key "forward-sexpr" "\^x)") (local-bind-to-key "backward-sexpr" "\^x(") (local-bind-to-key "re-indent-funcs" "\^x=") (local-bind-to-key "indent-lisp-function" "\ej") (local-bind-to-key "re-indent-line" "\ei") (local-bind-to-key "back-function" "\^x[") (local-bind-to-key "forw-function" "^x]") (local-bind-to-key "semi-colon-comment" ";") (setq mode-string "lisp") (use-syntax-table "lisp") (setq Current-syntax-table "lisp") (novalue)) (mlisp-mode (lisp-mode) ; set up local keys (use-syntax-table "mlisp") (setqdefun paren-pausedotinstabstempTifeolp&delete-white-space6setqfbolp,&,insert-character)save-excursionb|Terror-occurred22&ucb-backward-paren!H Current-syntax-table "mlisp") (local-bind-to-key "expand-mlisp-word" "\^x~") (local-bind-to-key "execute-mlisp-buffer" "\^x`") (setq mode-string "mlisp") (novalue)) ) ; the mlisp syntax table is like lisp except vertical bar is not quoting (use-syntax-table "mlisp") (modify-syntax-entry "() (") (modify-syntax-entry ")( )") (modify-syntax-entry """ '") (modify-syntax-entry """ """) (modify-syntax-entry "\\ \\") (modify-syntax-entry "w -+!$%^&=_~:/?|*<>") ; lisp syntax table (use-syntaxmessage.Can't find balancing parenprogn2descol.Z"current-column(goto-charactern to-colz"dot-is-visible"sit-for$beginning-of-lineset-mark end-of-line*T$region-to-string` nl-indentcol-table "lisp") (modify-syntax-entry "() (") (modify-syntax-entry ")( )") (modify-syntax-entry """ |") (modify-syntax-entry """ """) (modify-syntax-entry "\\ \\") (modify-syntax-entry "w -+!$%^&=_~:/?*<>") ; this syntax table makes almost everything a word, making it easy ; to skip white space (use-syntax-table "wordall") (modify-syntax-entry "w -+!$%^&=_~:/?*<>|()""';") (declare-global Current-syntax-table) l rings: ")) (setq ringpos (+ nrings 1)) (while (> ringpos 1)>bal."current-indent$\while <N$forward-character8 looking-atelseif.re-indent-thenelseB@thenzelse|@Hr4 ucb-backward-balanced-paren-line6n0"= L:lisp.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zn ^rPH0"following-char(.ft"+Z,prog letbind lambdacaseq :0>use-syntax-tablewordall$forward-skip-word(forward-skip-non-word.z(Current-syntax-tablerj:T >; ~^lzFT6D p  newline 4)&Rz>V(If:(if6$2*arg"comment-column* left-margin.  right-marginM<\  prefix-string; & insert-stringB;ml-paren(>8get-tty-command ( novalueV lisp-mode2local-bind-to-keyb)<  forward-parenmark(delete-next-character re-indent-lineH \t < 0\ bobp8d&backward-character indent-sexprstartendrlpn(R error-message2Not sitting on left parenthesisfRR$)>"backward-paren( X "8)"("="j"Ti"`["l|^x] J^;<f mode-stringlisp 6 mlisp-modepucb-forward-parent.  next-line~T&neobp"<= |indent-lisp-functionRtB<re-search-reverse^(def,B&Can't find function|Done!re-indent-funcs~0$get-tty-characterzmlisp@v$expand-mlisp-word~D6(execute-mlisp-buffer`.J 8@modify-syntax-entry() ( )( ) " ' " " d\ \0D*w -+!$%^&=_~:/?|*<>  ( < " |=6%f&@  Bad = option> back-function^(deJ forw-function*re-search-forward\ forward-sexpr6search-forward(^backward-sexpr6search-reverse) :semi-colon-commentZ: ( P d.(w -+!$%^&=_~:/?*<> <4~.w -+!$%^&=_~:/?*<>|()"';(declare-globalLmodify-syntax-entry "w -+!$%^&=_~:/?*<>") ; this syntax table makes almost everything a word, making it easy ; to skip white space (use-syntax-table "wordall") (modify-syntax-entry "w -+!$%^&=_~:/?*<>|()""';") (declare-global Current-syntax-table) l rings: ")) (setq ringpos (+ nrings 1)) (while (> ringpos 1) L:mark-ring.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zdeclare-global mark-numbertop-mark"mark-ring-sizeMark-0Mark-1Mark-2Mark-3Mark-4Mark-5Mark-6Mark-7Mark-8Mark-9&setq defunmark-c(declare-global mark-number top-mark mark-ring-size Mark-0 Mark-1 Mark-2 Mark-3 Mark-4 Mark-5 Mark-6 Mark-7 Mark-8 Mark-9) (setq mark-number 0) (setq top-mark "Mark-0") (setq mark-ring-size 10) (defun (mark-cycle-ring (setq top-mark (concat "Mark-" (setq mark-number (% (+ mark-number (arg 1)) mark-ring-size))))) (mark-push (error-occurred (execute-mlisp-line (concat "(setq " (mark-cycle-ring 1) " (mark))"))) (set-mark)) (mark-pop n (setq n (execute-mlisp-liycle-ring~6concatMark-^@R%8+arg mark-pusherror-occurredpexecute-mlisp-lineJ(setq  (mark))set-markmark-popn <ifprogn& pone top-mark)) (if n (progn (pop-to-buffer n) (goto-character n) (exchange-dot-and-mark) (mark-cycle-ring -1)) (goto-character (mark)))) (mark-set/pop (if prefix-argument-provided (mark-pop) (mark-push))) ) "dot-is-visible"sit-for$beginning-of-lineset-mark end-of-line*T$region-to-string` nl-indentcolp-to-buffer(goto-character\(exchange-dot-and-markmark^ mark-set/pop>,prefix-argument-providedelseif.re-indent-thenelseB@thenzelse|@Hr4 ucb-backward-balanced-paren-line6n0"= L:mark-ring.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z L: normal-mode.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z(defun (normal-mode (setq right-margin 1000) (setq left-margin 1) (use-abbrev-table "normal-mode") (remove-all-local-bindings) (setq mode-string "Normal") (novalue) )) Mark-2Mark-3Mark-4Mark-5Mark-6Mark-7Mark-8Mark-9&setq defunmark-c(progn ; this code was modified on or about Thu Apr 9 06:36:37 1981 ; by Doug Philips to add the &occurrences-extra-lines variable. ; ; this code was written on or about Mon Feb 2 06:11:03 1981 ; by Doug Philips to imitate the $Xoccurrences command in Twenex Emacs ; Unfortunately, this emacs doesn't allow one to scribble on the screen, and ; then have emacs restore the screen, which would be the way to go with ; this command. ; ; What the global variable is used for: ; ; &occurrences-extra-lines is a globQ RL: normal-mode.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zal variable that controls how many extra ; surrounding lines are printed in addition to the line containing the ; string found. If this variable is 0 then NO additional lines are printed. ; If this variable is greater than 0 then it will print that many lines ; above and below the line on which the string was found. When printing ; more than one line per match in this fashion, it will also print a ; separator of '----------------' so you can tell where the different ; matches begin and end. At the end ofPdefun8 normal-mode@setq  right-margin, left-margin*use-abbrev-tableV,remove-all-local-bindings>B mode-stringNormalnovalueMark-8Mark-9&setq defunmark-c the buffer it prints ; '<<>>'. ; (declare-global &occurrences-extra-lines) (if (= "" &occurrences-extra-lines)(setq &occurrences-extra-lines 0)) (defun (occurrences occ-string c buf-name bpp o-count l-count temp-pos Occur-String (setq o-count (setq l-count 0))(setq buf-name (current-buffer-name)) (setq bpp (dot)) (setq occ-string (get-tty-string "Search for all occurrences of: ")) (switch-to-buffer "excursions")(erase-buffer) (switch-to-buffer buf-name)(goto-character bp   L:!occur.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zp) (while (! (error-occurred (search-forward occ-string))) (setq o-count (+ 1 o-count))(setq l-count &occurrences-extra-lines) (beginning-of-line)(setq temp-pos (dot)) (while (> l-count 0) (&PL-Begin) (setq l-count (- l-count 1))) (set-mark) (goto-character temp-pos) (&NL-Begin) (setq temp-pos (dot)) (setq l-count &occurrences-extra-lines) (while (> l-count 0) (&NL-Begin) (setq l-count (- l-count 1))) (setq Occur-String (region-to-string)) (switch-to-buffer "excursions") (end-of-file) (if (< 0 &occurrences-extra-lines) (progn (insert-string "----------------") (newline))) (insert-string Occur-String) (switch-to-buffer buf-name)(goto-character temp-pos) ) ;;; End of while loop searching (switch-to-buffer "excursions") (save-excursion (end-of-file)(insert-string "<<>>") (newline)) ; (setq user-mode-line 1) (setq mode-line-format (concat "Found " o-count " occurrences of '" occ-string "' after position:  prognNdeclare-global,&occurrences-extra-linesjif.=&setq| defun occurrences occ-stringcbuf-namebppo-countl-counttemp-pos  Occur-String H" bpp " in: " buf-name)) (beginning-of-file) (while (! (eobp)) (message "--More?--(space=next page, ^G=abort, anything else is executed)") (setq c (get-tty-character)) ; grab a character (if (= c ' ') (progn (end-of-window) ; keep going (if (! (eobp)) ; but not if on last page! (next-page) ) ) (= c 7) (end-of-file) ; quit (progn (push-back-character c); execute-it (end-of-file) ) ) ) (switch-to-buffer buf-name) (goto-characterbuf-name&current-buffer-name"ldot`JTget-tty-string2Search for all occurrences of: Bswitch-to-buffer excursions  erase-buffer (goto-character2while^!Jerror-occurred(search-forward@."+v bpp) o-count ) ;;; End of occurrences (&NL-Begin (next-line) (beginning-of-line)) (&PL-Begin (previous-line) (beginning-of-line)) ) ) <= |indent-lisp-functionRtB<re-search-reverse^(def,B&Can't find function|Done!re-indent-funcs~0$get-tty-characterz4$beginning-of-linezhr">( &PL-Begin.$"-set-mark b &NL-BeginJt$@>*\ nBN60NX$region-to-string 8V end-of-fileif"<Rv   L:!occur.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zprognD insert-string$----------------newline P T  <ZZsave-excursion,N&<<>>f$mode-line-formatconcatFound $ occurrences of '&' after position:  in: @$beginning-of-filepeobplmessageR?--More?--(space=next page, ^G=abort, anything else is executed)00$get-tty-charactern T.  end-of-window.  next-pagedp8,push-back-character8 Z (X next-linef,  previous-line:c-string "' after position: ' (L:#paragraphs.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zo pL:"paragraphs.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zifX!Dis-bound(paragraph-delimitersprogn(declare-global@setq"^ \|^[@.' ].* defunforward-paragraph$beginning-of-line*re-search-forwardrwhile2 looking-at(search-forward<6(if (! (is-bound paragraph-delimiters)) (progn (declare-global paragraph-delimiters) (setq paragraph-delimiters "^\n\\|^[@.' \t].*\n") )) (defun (forward-paragraph (beginning-of-line) (re-search-forward paragraph-delimiters) (while (looking-at "") (search-forward ""))) ) (defun (backward-paragraph (beginning-of-line) (previous-line) (while (& (looking-at paragraph-delimiters) (! (bobp))) (progn (previous-line) (beginning-of-line))) (if (error-occurred backward-paragraph  previous-lineV@>& >bobpvrLerror-occurred*re-search-reverse$beginning-of-filet   (goto-character2while^!Jerror-occurred(search-forward@."+v(re-search-reverse "")) (beginning-of-file)) (while (looking-at "") (search-forward ""))) ) Tget-tty-string2Search for all occurrences of: Bswitch-to-buffer excursions  erase-buffer (goto-character2while^!Jerror-occurred(search-forward@."+v L:#profile.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z(defun (help (info))) (autoload "info" "info.ml") (autoload "dired" "dired.ml") (autoload "incremental-search" "incr-search.ml") (autoload "reverse-incremental-search" "incr-search.ml") (autoload "electric-c-mode" "electric-c.ml") (autoload "lisp-mode" "lisp.ml") (autoload "mlisp-mode" "lisp.ml") (setq quick-redisplay 1) (setq default-mode-line-format " %[Buffer: %b%* File: %f %M (%m) %p%]") (setq backup-before-writing 1) (setq backup-by-copying-when-linked 1) (load "killring") (load "buffer-edit") (setqsetq"quick-redisplayn,default-mode-line-format<( %[Buffer: %b%* File: %f %M (%m) %p%]6T(backup-before-writing>0backup-by-copying-when-linked4loadkillring$ buffer-editL setq-default$&kill-lines-magic< auto-executet*.c"-default &kill-lines-magic 1) (auto-execute "electric-c-mode" "*.c") (auto-execute "electric-c-mode" "*.h") (auto-execute "mlisp-mode" "*.ml") (auto-execute "lisp-mode" "*.l") (auto-execute "mlisp-mode" "*.emacs_pro") verse$beginning-of-filet   (goto-character2while^!Jerror-occurred(search-forward@."+vR*.h$*.ml"T*.l*`n *.emacs_pro.$"-set-mark b &NL-BeginJt$@>*\ nBN60NX$region-to-string 8V end-of-fileif"<Rv L:$profile.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z L:$pwd.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zHdefun0helpinfo<autoloadinfo.ml:direddired.mlN&incremental-search"incr-search.ml:@.reverse-incremental-searchH"electric-c-mode  electric-c.ml< lisp-modelisp.ml* mlisp-modeB(if (! (is-bound cdpath)) (setq-default cdpath ".:~")) (defun (path (pwd)(novalue))) (defun (pwd cwd cue (if (interactive) (setq cue ": pwd => ") (setq cue ": path => ")) (setq cwd (working-directory)) (message cue (if (& (= (substr cwd -1 1) "/") (> (length cwd) 1)) (substr cwd 1 -1) cwd)) (novalue)) (chd dir (setq dir (if (interactive) (get-tty-file ": chd ") (arg 1))) (cd dir) (novalue)) (cd dir path still-looking (setq dir (if (interactive) (get-tty-file ": cd ") (arg 1))) (if (= dir "") (setq dir "~")) (if (| (= (substr dir 1 1) "/") (= (substr dir 1 1) "~")) (setq still-looking (error-occurred (change-directory dir))) (save-excursion (temp-use-buffer "Scratch Stuff") (setq needs-checkpointing 0) (erase-buffer) (insert-string cdpath) (beginning-of-file) (while (progn (re-search-forward "[^:]*") (region-around-match 0) (setq path (region-to-strinmessage&X=0substr/<> length`L6 chddirpNd: get-tty-file: chd argcdhLV  still-lookingD$8&Z@g)) (erase-region) (delete-next-character) (setq still-looking (error-occurred (change-directory (if (= path "") dir (concat path "/" dir))))) (& still-looking (! (eolp)))) (novalue)))) (if still-looking (error-message "There is no such directory") (progn (quietly-read-abbrev-file ".abbrevs") )) (novalue)) ) ing 8V end-of-fileif"<Rv: cd \F   ~hd|(z(RXLerror-occurred*change-directorysave-excursionBtemp-use-buffer  Scratch Stuff4&needs-checkpointing  erase-buffer& insert-stringT$s tL:%pwd.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zbeginning-of-filewhileprogn<re-search-forward[^:]*.region-around-match0$region-to-string  erase-region(delete-next-characterb*~VPJb,concat6n*zeolp(@N error-message.ifJ!6is-boundcdpath< setq-default.:~`defunHpathpwdnovaluevcwdcue interactive:setq : pwd => * : path => 0J$working-directoryThere is no such directoryNHquietly-read-abbrev-file.abbrevszs executed)00$get-tty-charactern T.  end-of-window.  next-pagedp8,push-back-character8 Z (X next-linef,  previous-line:c-string "' after position:  L:&readonly.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z,6&Buffer is read-onlynovaluesubstr/<> length`L6 chddirpNd: get-tty-file: chd argcdhLV  still-lookingD$8&Z@; Make the current buffer read only (defun (read-only (if read-only (progn (setq read-only 0) (if (= (substr mode-line-format -3 3) " RO") (setq mode-line-format (substr mode-line-format 1 -3))) (message "Buffer is now writable") ) (progn (setq read-only 1) (if (!= (substr mode-line-format -3 3) " RO") (setq mode-line-format (concat mode-line-format " RO"))) (message "Buffer is read-only") ) ) (novalue) ) ) ng-directoryO PL:'sentences.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zI JL:&readonly.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z(if (! (is-bound sentence-delimiters)) (progn (declare-global sentence-delimiters) (setq sentence-delimiters "[.!?][ \n\t][ \n\t]*") )) (defun (forward-sentence (prefix-argument-loop (re-search-forward sentence-delimiters) (while (looking-at "") (search-forward ""))) ) ) (defun (backward-sentence stpos searchp (prefix-argument-loop (setq stpos (dot)) (preceding-char) (if (error-occurred (re-search-reverse sentence-delimiters)) Hdefun0 read-onlyif(progn&setqx=Nsubstr$mode-line-format RO(`Dmessage*Buffer is now writablep8!=02&concat (beginning-of-file)) (setq searchp (dot)) (while (looking-at "") (search-forward "")) (if (>= (dot) stpos) (progn (goto-character searchp) (if (error-occurred (re-search-reverse "")) (beginning-of-file)) (while (looking-at "") (search-forward ""))) ) ) ) ) : chd argcdhLV  still-lookingD$8&Z@ L:(sentences.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z; shift the current window left or right (defun (dot-to-left-margin (setq left-offset (- (current-column) 1))) (dot-to-right-margin (setq left-offset (- (current-column) (window-width)))) (dot-to-centre (setq left-offset (- (current-column) (/ (window-width) 2)))) ) (bind-to-key "dot-to-left-margin" "\^x<") (bind-to-key "dot-to-right-margin" "\^x>") (bind-to-key "dot-to-centre" "\^x=") 2 looking-at(search-forwardifV!Bis-bound&sentence-delimitersprogn(declare-globalBsetq$[.!?][ ][ ]*defunforward-sentenceprefix-argument-loop*re-search-forwardrwhile2 looking-at(search-forward L:(shift.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zbackward-sentencestpossearchp"`dot"preceding-charvpLerror-occurred*re-search-reversej$beginning-of-file$Jd v ">= j(goto-charactert $B   okingD$8&Z@jdefundot-to-left-margintsetq left-offset>-"current-column^dot-to-right-margin8j|,  window-widthZ dot-to-centre:$.<J"/: bind-to-key<" >"H= L:(shift.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zq L:)srccom.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z; srccom: compare text in two windows ; To begin the comparison, place the dot at the beginning of one of the ; two pieces of text to be compared, switch to the other window, and place ; the dot at the beginning of the other piece of text. (If there are more ; than two windows, the two windows to be compared must be adjacent, and ; the dot must be left in the upper one.) When this function is invoked, ; it will search forward, stopping when either a difference is encountered ; or the end of the buffer isxdefun:srccomm1size4setqdotwhileh&,!eobp(compare-strings*.<"*if lzb4"> d."/x = reached. ; HISTORY: ; Dec 14 1982 -- agin -- Completely rewritten for increased efficiency ; 1 June 1982 -- Jerry Agin at Carnegie-Mellon University -- created (defun (srccom m1 size (setq m1 (dot)) (setq size 1) (while (& (! (eobp)) (compare-strings size) ) (setq size (* size 2)) ) (if (! (eobp)) (while (> size 0) (compare-strings size) (setq size (/ size 2)) ) ) (if (= (dot) m1) (error-message "First characters are different!") ; ring the b<R error-message2First characters are different!&csizes1s2cm1cm2*argset-markVhBgoto-character +J0 $region-to-string next-windowF\xhell if dot didn't move ) ) (compare-strings csize s1 s2 cm1 cm2 (setq csize (arg 1)) (set-mark) (setq cm1 (dot)) (goto-character (+ cm1 csize)) (setq s1 (region-to-string)) (next-window) (set-mark) (setq cm2 (dot)) (goto-character (+ cm2 csize)) (setq s2 (region-to-string)) (if (= s1 s2) (progn (previous-window) 1 ) (progn (goto-character cm2) (previous-window) (goto-character cm1) 0 ) ) ) ) & insert-stringT$vBprogn"previous-window, ^ 6)) (goto-character (+ cm1 csize)) (setq s1 (region-to-string)) (next-window) (set-mark) (setq cm2 (dot)) (goto-character (+ cm2 csize)) (setq s2 (region-to-string)) (if (= s1 s2) (progn (previous-window) 1 ) (progn (goto-character cm2) (previous-window) (goto-character cm1) 0 ) ) ) ) & insert-stringT$yp zL:*srccom.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zo L:+tags.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z; Edit 7 ; Fri Jul 16 18:05:28 1982 ; twenex-like tags package J. Gosling, November 81 ; ; A tag file is a sequence of lines of the following forms: ; ^_filename ; ^Atagline^Bposition ; A tagline/position pair refers to the preceeding file (declare-global last-search-tag) (defun (to-tag-buffer (temp-use-buffer "*TAG*") (if (& (= (buffer-size) 0) (= (current-file-name) "")) (progn (if (error-occurred (read-file ".tags")) (progn (write-named-file ".tags") (messame)) (to-tag-buffer) (beginning-of-file) (if (error-occurred (re-search-forward (concat "\^_" fn "[^\^_]*"))) (progn (beginning-of-file) (insert-character '^_') (insert-string fn) (newline))) (store-pos-str) (beginning-of-file)))) (defun (add-tag* pos str (find-pos-str) (save-excursion (temp-use-buffer "*TAG*") (store-pos-str)))) (defun (add-all-tags pattern fn (setq pattern (arg 1 ": addge "New tag file"))) (beginning-of-file))) )) (defun (visit-tag-table tagfn (setq tagfn (arg 1 ": visit-tag-table ")) (save-excursion (temp-use-buffer "*TAG*") (read-file tagfn)) )) (defun (goto-tag fn str pos restart (setq restart 0) (if (! prefix-argument-provided) (progn (setq last-search-tag (concat "\^A[^\^B]*" (quote (arg 1 ": goto-tag ")))) (setq restart 1))) (save-excursion (to-tag-buffer) (if restart-all-tags (pattern) ")) (setq fn (current-file-name)) (save-excursion (to-tag-buffer) (if (error-occurred (search-forward (concat "\^_" fn "\n"))) (progn (beginning-of-file) (insert-character '^_') (insert-string fn) (newline)) (progn (set-mark) (while (= (following-char) '^A') (next-line)) (erase-region)) ) ) (save-excursion (error-occurred (beginning-of-file) (while 1 (beginning-of-file)) (re-search-forward last-search-tag) (beginning-of-line) (re-search-forward "\^A\\([^\^B]*\\)\^B\\(.*\\)") (region-around-match 1) (setq str (region-to-string)) (region-around-match 2) (setq pos (- (region-to-string) 300)) (save-excursion (re-search-reverse "\^_\\(.*\\)") (region-around-match 1) (setq fn (region-to-string))) ) (visit-file fn) (goto-character pos) (if (error-occurred (search-fo (re-search-forward pattern) (add-tag*)))) (novalue) ) ) (defun (add-typed-tags ext pattern (setq ext (substr (current-file-name) -2 2)) (add-all-tags (if (= ext ".l") "^(def" (= ext ".c") "^[A-z].*(.*)" (= ext "ml") "^(defun[ \t\n]*(" (= ext "ss") "@section\\|@chapter\\|@subsection" (= ext ".p") "function\\|procedure" (error (concat "Can't tag " (current-file-name))) ) ) )) (defun (tag-file fn (setq fn (argrward str)) (search-reverse "")) (beginning-of-line) (line-to-top-of-window) )) (defun (find-pos-str (beginning-of-line) (setq pos (+ (dot) 0)) (set-mark) (end-of-line) (setq str (region-to-string)))) (defun (store-pos-str (insert-character '^A') (insert-string str) (insert-character '^B') (insert-string pos) (newline))) (defun (add-tag (save-excursion pos str fn (find-pos-str) (setq fn (current-file-na 1 ": tag-file (filename) ")) (message (concat "Tagging " fn)) (save-window-excursion (error-occurred (visit-file fn) (add-typed-tags) (delete-buffer fn))))) ; deletes current buffers if they ; are also having tags computed (defun (recompute-all-tags (save-window-excursion (to-tag-buffer) (beginning-of-file) (error-occurred (while 1 (re-search-forward "\^_\\(.*\\)") (region-around-match 1) (tag-file (region-to-string))) ) (write-named-file ".tags")))) (defun (make-tag-table fns (setq fns (arg 1 ": make-tag-table (from filenames) ")) (save-window-excursion (temp-use-buffer "*TEMP*") (erase-buffer) (set-mark) (filter-region (concat "dir " fns)) (beginning-of-file) (while (! (eobp)) (set-mark) ; (end-of-line) (search-forward " ") (backward-character) (tag-file (region-to-string)) (next-linemessage  New tag file$beginning-of-filevisit-tag-tabletagfnbsetqDarg&: visit-tag-table :save-excursion b~ rVgoto-tagfnstrposrestart@!,prefix-arg) (beginning-of-line)) (delete-buffer "*TEMP*") (temp-use-buffer "*TAG*") (write-named-file ".tags")) (novalue) )) (defun (visit-function func (save-window-excursion (forward-character) (backward-word) (set-mark) (forward-word) (setq func (region-to-string)) (goto-tag func) (message "Type ^C to go back") (recursive-edit) ) )) 6 mlisp-modepument-providedN xconcat[^]*Dquote,P : goto-tag Tv*re-search-forward8$beginning-of-line*$\([^]*\)\(.*\).region-around-match0.$region-to-string."-,d$>re-search-'n (L:,tags.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zreverse\(.*\)&p(F$ visit-file(goto-character\..(search-forward(search-reversef(line-to-top-of-window2 find-pos-str>\@2+dotset-mark end-of-line| store-pos-str,Ddeclare-global"last-search-tagdefun to-tag-buffer:temp-use-buffer*TAG*if&:= buffer-size>$current-file-nameprognJVerror-occurred4 read-file.tagsj*write-named-file:insert-character& insert-string4 0newlineadd-taghpblvD>8>\[^]*,> LFadd-tag*v  : add-all-tagspatternzF: ,: add-all-tags (pattern) p(n2(,D& ,f dwhile0"following-char next-line  erase-region2,4 n nfnovalue*$add-typed-tagsext<0substr.back"recursive-editdelete-buffer "*TEMP*") (temp-use-buffer "*TAG*") (write-named-file ".tags")) (novalue) )) (defun (visit-function func (save-window-excursion (forward-character) (backward-word) (set-mark) (forward-word) (setq func (region-to-string)) (goto-tag func) (message "Type ^C to go back") (recursive-edit) ) )) 6 mlisp-modep".l^(def"`.c  ^[A-z].*(.*)"Pml"^(defun[ ]*(" ss2@section\|@chapter\|@subsection".p&function\|procedureBerror* Can't tag ttag-fileDx8* )m  *L:-tek4404.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z: tag-file (filename) .(Tagging fsave-window-excursion>  & delete-buffer~recompute-all-tagsXrxL:4 2 X make-tag-tablefnsP&D86": make-tag-table (from filenames) < *TEMP* ; Support and default bindings for the TEK4404 mouse and joydisk (defun (convert-to-decimal num ch (setq num 0) (while (& (>= (setq ch (get-tty-character)) '0') (<= ch '9')) (setq num (+ (- ch '0') (* num 10)))) (push-back-character ch) num) (move-dot-to-mouse x y (setq y (convert-to-decimal)) ; get row value (get-tty-character) ; throw away ';' (setq x (convert-to-decimal)) ; get column value (get-tty-character) ; throw away the ESC (get-tty-character) ; throw away t erase-buffervD filter-region$dir bneobp &backward-character 4   r>visit-functionfunc $forward-character  backward-word  forward-wordv td,(&Type ^C to go he BACKSLASH (move-dot-to-x-y x y)) (mouse-set-mark (set-mark) (move-dot-to-mouse) (sit-for 10) (exchange-dot-and-mark) (message "Mark set")) (mouse-ignore-button t (setq t (convert-to-decimal)) ; get row value and ignore it (get-tty-character) ; throw away ';' (setq t (convert-to-decimal)) ; get column value and ignore it (get-tty-character) ; throw away the ESC (get-tty-character))) ; throw away the BACKSLASH ; Bind the mouse buttons (bind-to-key "move-dot-to-mouse " "\ePA1D") ; left mouse button (bind-to-key "mouse-set-mark" "\ePB1D") ; shifted left mouse button (bind-to-key "mouse-ignore-button" "\ePA2D") ; middle mouse button (bind-to-key "mouse-ignore-button" "\ePB2D") ; shifted middle mouse button (bind-to-key "mouse-ignore-button" "\ePA3D") ; right mouse button (bind-to-key "mouse-ignore-button" "\ePB3D") ; shifted right mouse button ; This could be continued for all mouse button combinations ; Bind the break key so that is aborts (bind-to-key "illegal ; row,column coords ; (TEKSGCRT) .l^(def"`.c  ^[A-z].*(.*)"Pml"^(defun[ ]*(" ss2@section\|@chapter\|@subsection".p&function\|procedureBerror* Can't tag ttag-fileDx8*-operation" "\eO@") ; break ; Bind the joydisk in all its modes (bind-to-key "previous-line" "\eOA") ; joydisk up (bind-to-key "next-line" "\eOB") ; joydisk down (bind-to-key "backward-character" "\eOD") ; joydisk left (bind-to-key "forward-character" "\eOC") ; joydisk right (bind-to-key "previous-page" "\eO!") ; shift joydisk up (bind-to-key "next-page" "\eO\"") ; shift joydisk down (bind-to-key "backward-word" "\eO$") ; shift joydisk left (bind-to-key "forward-word" "\eO#") ; shift joydisl L:.tek4404.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zk right (bind-to-key "illegal-operation" "\eO1") ; control joydisk up (bind-to-key "illegal-operation" "\eO2") ; control joydisk down (bind-to-key "illegal-operation" "\eO4") ; control joydisk left (bind-to-key "illegal-operation" "\eO3") ; control joydisk right ; Bind a couple of the function keys, just to show how they work (bind-to-key "beginning-of-file" "\eOE") ; f1 (bind-to-key "end-of-file" "\eOF") ; f2 ;;; The following section is included to show how to turn on emulator ;;; modes and mousdefunconvert-to-decimalnumch&setqwhile&N>=0$get-tty-character0$<=89d@X+"-0"* ,push-back-charactermove-dot-to-mousexe functions from a host. This is wired in to the ;;; Trm4404 driver and not needed when running the 4404 resident emacs. ; Now send the strings that set up the terminal emulator modes ; (send-string-to-terminal "\e>") ; turn on TEKKPAM ; (send-string-to-terminal "\e[?1h") ; turn on TEKCKM ; (send-string-to-terminal "\eQ1M") ; enable graphics cursor and ; tie it to mouse position ; (TEKEGC) ; (send-string-to-terminal "\eQ1;1J") ; enable mouse to return ; button presses and y^F.move-dot-to-x-ymouse-set-markset-mark"sit-for (exchange-dot-and-mark6messageMark setpmouse-ignore-buttont^F@< bind-to-keyPA1D$!PB1D$.PA2D$ PB2D$\PA3D$8PB3D@$illegal-operationO@<  previous-lineOA8 next-lineOBB`&backward-characterOD@$forward-characterOC<  previous-pageen" "\^xo") (setq mode-string "text-mode-2") (novalue) ) ) (defun (new-justify (error-occurred (save-excursion (end-of-line) (new-back-to-point-setting-margin) (if (! (eolp)) (while ; for each line in the current paragraph (progn (while ; while this line is too long (progn (end-of-line) (> (current-column) right-margin)) (while ; back up to a space or tab (& (| (> (current-column) right-margin) O!8 next-pageO"<j  backward-wordO$<.  forward-wordO#"O1"O2"O4"|O3@j$beginning-of-fileOE:* end-of-fileOF joydisk left (bind-to-key "forward-word" "\eO#") ; shift joydis (& (!= (preceding-char) ' ') (!= (preceding-char) ' '))) (! (bolp))) (backward-character) ) (if (bolp) ; If line is all one word (next-line); forget about justifying it (progn ; else delete whitespace just found (delete-previous-character) (delete-white-space) (newline) ; and break the line (to-col left-margin) (insert-string prefix-string) ) ) ) ; end while line isc L:/text-mode-2.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z too long (beginning-of-line) ; try the next line (next-line) (if (eolp) ; This is the end of the test in the ; while loop that goes through all ; lines in the current paragraph. ; If we pass, we're not on the blank ; line at the end (in open mode) or ; on the point line of the next ; paragraph (in closed mode) 0 (save-excursion (while (! (= (current-column) (current-indent(defun (text-mode-2 (declare-global new-point-char) (setq new-point-char '>') (declare-global new-open-mode) (setq new-open-mode 1) (declare-global new-prefix-string) (setq new-prefix-string " ") (setq left-margin 1) (setq right-margin 77) (local-bind-to-key "new-make-point" new-point-char) (local-bind-to-key "new-indent-line" "\ei") (local-bind-to-key "new-dedent-line" "\eu") (local-bind-to-key "new-justify" "\ej") (local-bind-to-key "new-close" "\^xc") (local-bind-to-key "new-op))) (forward-character)) (! (new-at-point)) ) ) ) (beginning-of-line) (delete-previous-character) ; Tack this non-blank ; line onto the ; previous one. (delete-white-space) (insert-string " ") ) ; end while [for each line...] ) ; end if ! eolp ) ; end save-excursion ) ) (new-back-to-point-setting-margin (if ; if not at last point (& (! (bobp)) (! (new-at-point))! ) (while ; then go back to last point (if (progn (beginning-of-line) (bobp)) 0 ; quit while loop if at start of buffer (progn ; else check the first printing character (while (! (= (current-column) (current-indent))) (forward-character)) (! (new-at-point))) ) ; end of while test (previous-line) ) ) ; end if not at last point (setq prefix-string new-prefix-string); SIDE EFFECT!!! (setq left-margin (current-indent)); SIDE EFFECT!re (save-excursion (while (& (! (new-at-point)) (! (bobp)) ) (backward-character) ) (! (new-at-point)) ) ) ) (first-line (save-excursion (beginning-of-line) (bobp) ) ) (blankline (save-excursion (end-of-line) (= (current-column) (current-indent)) ) ) (new-at-point (& (= (following-char) new-point-char) (= (current-column) (current-indent))) ) (new-dedent-line (beginning-of-line) (to-col (- !! ) (new-forward-to-no-more-indented-point (while ; move ahead to next point with level <= col (& (! (eobp)) (! (& (new-at-point) (<= (current-indent) left-margin) ) ) ) (next-line) (beginning-of-line) (while (! (= (current-column) (current-indent))) (forward-character)) ) ) (new-back-to-end-of-non-blank-line (while (& (! (blankline)) (! (bobp)) ) (previous-line) ) (end-of-line) ) (n(current-indent) 4)) (insert-string ".") (delete-white-space) (delete-previous-character) (end-of-line) (if (> left-margin 3) (setq left-margin (- left-margin 4)) ) ) (new-indent-line (beginning-of-line) (to-col (+ (current-indent) 4)) (insert-string ".") (delete-white-space) (delete-previous-character) (end-of-line) (setq left-margin (+ left-margin 4)) ) (new-close (setq new-open-mode 0) (save-excursion (beginning-of-file) (while (! (ew-make-point (if (new-making-first-point) (progn ; Making first point (setq left-margin 1) (setq prefix-string new-prefix-string) (while (& (! (new-at-point)) (! (eobp)) ) (forward-character) ) (if (! (bolp)) (newline) (newline-and-backup) ) (if new-open-mode (newline-and-backup)) ) (progn ; Not making first point (new-back-to-point-setting-margin) (end-of-line) (new-forward-to-no-more-indented-point) (beginning-of-line) (previoueobp)) (beginning-of-line) (if (blankline) (kill-to-end-of-line) (next-line) ) ) ) ) (new-open col (setq col left-margin) (setq new-open-mode 1) (save-excursion (end-of-file) (while (progn (new-back-to-point-setting-margin) (! (bobp)) ) (previous-line) (end-of-line) (if (! (blankline)) (newline)) ) (if (blankline) (kill-to-end-of-line)) ) (setq left-margin col) ) ) (setq ringpos (+ nrings 1)) (while (> ringpos 1)s-line) ; Back up (while (& (blankline) (! (first-line)) ) (previous-line) ) (end-of-line) (newline) ; and sit in the middle of 2 newlines (if new-open-mode (newline)) ) ) ; end if (to-col left-margin) (insert-character new-point-char) (insert-character ' ') ; The convention calls for a space after the ; point char ) (new-making-first-point ; returns true if dot is positioned before ; the first point. (if (bobp) 1 ; This should really be hew- xL:0text-mode-2.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z"6defun text-mode-2Ddeclare-global"new-point-char&setq>&  new-open-mode*`$new-prefix-string"z ,X left-margin.,  right-marginMLlocal-bind-to-key"new-make-point>"new-indent-line &  previous-lineT$B%new-forward-to-no-more-indented-pointX`eobp4B.n"<=R$.rz!new-back-to-end-of-non-blank-line@4T" blankline |TH*new-making-first-pointr`p*. i>z"new-dedent-lineu:< new-justifyj8 new-closec8new-openo* mode-stringnovalue @60error-occurredsave-excursion end-of-line4 new-back-to-point-setting-marginif,( > &newline-and-backupL~8<0$R first-lineJ* ,B*insert-characterD VrPV<"*P  $ |($&LlF."following-charj!eolpXwhileprogn&H4<>"current-column&|Z@!="preceding-char  bolp&backward-characterf next-line,delete-previous-character&delete-white-spacev d("-.|J&:r r2(d"+ \j 4(vbz8$beginning-of-fileP 68j&kill-to-end-of-linecol^x|newline to-col@ insert-string  prefix-string$beginning-of-lineBfljB8<="current-indent$forward-character&  new-at-point.\ 6d0$nbobp P|pV(|6b$D end-of-fileB  fV $Dng new-prefix-string) (while (& (! (new-at-point)) (! (eobp)) ) (forward-character) ) (if (! (bolp)) (newline) (newline-and-backup) ) (if new-open-mode (newline-and-backup)) ) (progn ; Not making first point (new-back-to-point-setting-margin) (end-of-line) (new-forward-to-no-more-indented-point) (beginning-of-line) (previou";, <L:1text-mode.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zerror-occurred"text-mode-hooknovalue< new-justifyj8 new-closec8new-openo* mode-stringnovalue @60error-occurredsave-excursion end-of-line4 new-back-to-point-setting-marginif,(defun (text-mode (remove-all-local-bindings) (local-bind-to-key "justify-paragraph" "j") (setq right-margin 77) (setq mode-string "Text") (setq case-fold-search 1) (use-syntax-table "text-mode") (use-abbrev-table "text-mode") (setq left-margin 1) (error-occurred (text-mode-hook)) (novalue) ) ) left-margin.,  right-marginMLlocal-bind-to-key"new-make-point>"new-indent-line L:5time.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zK LL:4text-mode.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z(declare-global &&old_mode_string) (declare-global &&ret_routine) (declare-global &&local_buffer) (defun (time (if (= &&ret_routine "") (progn (setq &&local_buffer (current-buffer-name)) (setq &&old_mode_string mode-string) (describe-bindings) (save-excursion (temp-use-buffer "Help") (beginning-of-file) (search-forward "^M") (forward-word) (backward-word) (set-mark) (forward-word) (setq &&ret_routine (region-to-string))) (pop-to-buffer &&local_buffer) Jdefun2 text-mode,remove-all-local-bindings^local-bind-to-key$justify-paragraphj@setq  right-marginM< mode-stringText2$case-fold-search*use-syntax-table*use-abbrev-tableb, left-marginD(delete-other-windows) (local-bind-to-key "change-time" "\n") (local-bind-to-key &&ret_routine "\^X\^T") (setq mode-string (substr (current-time) 12 5)) (novalue))))) (defun (change-time (setq mode-string (substr (current-time) 12 5)) (execute-string "\^X\^T"))) (defun (undo-time (setq mode-string &&old_mode_string) (remove-local-binding "\^X\^T") (local-bind-to-key &&ret_routine "\^M") (setq &&ret_routine "") (novalue))) to-point-setting-marginif,# L:5time.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zZ [L:6transp.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zFdeclare-global$&&old_mode_string&  &&ret_routine("&&local_bufferdefuntimenif.=b*prognDsetq>&current-buffer-name* mode-string$describe-bindingsJsave-excursion:temp-use-buffer(defun (transpose-char-smart (if (eolp) (transpose-characters) (progn (forward-character) (transpose-characters) (backward-character)))) (transpose-word-smart (if (eolp) (transpose-word) (progn (forward-word) (transpose-word) (backward-word))))) (progn ;;; This is a Semi-Auto-Frobic Transpose neato object library. ;;; It defines two functions: (which do the obvious things) Transpose-line Transpose-word ;;; It also declares 3 Global Variables toHelp$beginning-of-file8search-forward^M  forward-word  backward-wordset-mark0X~$region-to-string& pop-to-bufferZ(delete-other-windowsVlocal-bind-to-key change-time "VbJsubstr  curr control the Transpose line ;;; function and one global variable for communication to another function. (declare-global &Default-Transpose-Direction &Default-Transpose-Follow &Default-Transpose-Magic &Column-To-Be-At) (setq &Default-Transpose-Direction 1) (setq &Default-Transpose-Follow 0) (setq &Default-Transpose-Magic 0) (setq &Column-To-Be-At 1) ;;; What the Global Transpose variables mean: ;;; &Default-Transpose-Direction: (default 1) ;;; Tells Transpose-line which other linent-time novalue\fV:(0 (execute-string(  undo-timetj.remove-local-binding^Z"H  bolp&backward-characterf next-line,delete-previous-character&delete-white-spacee to transpose with the current ;;; one. If this is set to 1 (actually your favorite non-zero number ;;; will do) then Transpose-line will use the line above the current one ;;; and if it is 0 Transpose-line will use the line below the current ;;; one. ;;; ;;; &Default-Transpose-Follow: (default 0) ;;; If this is set Non-zero it will cause Transpose-line to leave ;;; the cursor(dot) on the line that got transposed, and if this is ;;; set to Zero it will stay at the same place in the file! ;;; &Default#-Transpose-Magic: (default 0) ;;; This variable controlls some magic inside the Transpose Line ;;; function. If it is set to zero, Transpose-line will behave as ;;; controlled by the settings of the above variables. If this is set ;;; Non-Zero then the magic is controlled by the cursor position when ;;; Transpose-line is invoked. If the cursor(dot) is somewhere in the ;;; middle of a line, then it behaves as if this variable were 0. If ;;; the cursor is at the end of a line, or at the beginning of ane) transpose-up ; implicitly (& transpose-up (! follow)) (progn (goto-column) (if (& &Default-Transpose-Magic (eolp)) (backward-character))) follow ; implicitly (& (! transpose-up) follow) (backward-character) (progn ; implicitly (& (! transpose-up) (! follow)) (previous-line) (previous-line) (goto-column) (if (& &Default-Transpose-Magic (eolp)) (backward-character))))) (transpose-word CurrentWord punc EMS (setq EMS "") (save-excursion (backw line, ;;; the magic will happen. If the cursor is at the beginning of the ;;; line Transpose-line will override the above variable settings and ;;; assert that you want to transpose with the above line and that you ;;; want to follow the line you were on. If the cursor is at the end of ;;; a line Transpose-line will assume that you want to transpose with ;;; the next line and that you want to follow the line you were on. The ;;; main reason for this magic is so that you can blip lines up and down ;;; inard-word) (if (bobp) (setq EMS "Can't Transpose here!") (progn (set-mark)(forward-word) (setq CurrentWord (region-to-string)) (backward-word)(backward-word)(forward-word) (setq punc (region-to-string))(delete-next-word) (backward-word) (insert-string (concat CurrentWord punc))))) (if (!= "" EMS) (error-message EMS))) (goto-column (beginning-of-line) (while (& (! (eolp)) (< (current-column) &Column-To-Be-At)) (forward-character))) ) (save-window-excu your buffer real easily. (defun (transpose-line foo transpose-up follow EMS mark-pos ; ^- Zero - down, NonZero - up (setq EMS "") (setq follow &Default-Transpose-Follow) (setq transpose-up &Default-Transpose-Direction) (if &Default-Transpose-Magic (if (bolp) (progn (setq transpose-up 1) (setq follow 1)) (eolp) (progn (setq transpose-up 0) (setq follow 1)))) (save-excursion ; just to save the damn mark. (setq &Column-To-Be-At (current-column)) (beginning-of-line) rsion (temp-use-buffer "&&^&&^&&^") (setq needs-checkpointing 0) ) (novalue) ) kward-character) ) (! (new-at-point)) ) ) ) (first-line (save-excursion (beginning-of-line) (bobp) ) ) (blankline (save-excursion (end-of-line) (= (current-column) (current-indent)) ) ) (new-at-point (& (= (following-char) new-point-char) (= (current-column) (current-indent))) ) (new-dedent-line (beginning-of-line) (to-col (-  (if (& (bobp) transpose-up) (setq EMS "Error - Can't transpose up here.") (progn (set-mark) (next-line)(beginning-of-line) (if (! (bolp))(progn (message "foo") (sit-for 5))) (if (& (eobp) (! transpose-up)) (setq EMS "Error - Can't transpose down here.") (delete-region-to-buffer "&&^&&^&&^"))))) (if (!= EMS "") (error-message EMS)) (if transpose-up (previous-line) (next-line)) (beginning-of-line) (yank-buffer "&&^&&^&&^") (if (& transpose-up follow) (previous-li   L:7transp.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z$defuntranspose-char-smartifeolp(transpose-charactershprogn$forward-character&backward-charactertranspose-word-smartz."transpose-wordLF  forward-word  backward-word *"Transpose-line"Transpose-wordde6<6,H0 CurrentWordpunc$DP"4(Can't Transpose here!|0R$region-to-stringlf:.$delete-next-word$F insert-string&concat$< L\Pwhile2 clare-global0&Default-Transpose-Direction,&Default-Transpose-Follow,&Default-Transpose-Magic$&Column-To-Be-At&setq@\ttranspose-linefoo  transpose-upfollowEMSmark-pos PZ <xsave-window-excursion(temp-use-bufferV4@&needs-checkpointingnovalue&Default-Transpose-Direction) (if &Default-Transpose-Magic (if (bolp) (progn (setq transpose-up 1) (setq follow 1)) (eolp) (progn (setq transpose-up 0) (setq follow 1)))) (save-excursion ; just to save the damn mark. (setq &Column-To-Be-At (current-column)) (beginning-of-line) `<^0bolp.hp*.4P<Psave-excursion."current-column$beginning-of-line<2&bobp"@|P4 Error - Can't transpose up here.dset-mark next-line*h!@H me L:8undo.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zssageB"sit-for*eobp ~B`46"Error - Can't transpose down here.Fdelete-region-to-buffer &&^&&^&&^N`"!=& error-messagej2$  previous-lineH$ yank-bufferD~B goto-columnn6r(defun (new-undo c (undo) (while (progn (message "Hit to undo more") (= (setq c (get-tty-character)) ' ')) (undo-boundary) (undo-more)) (message "Finished undoing.") (if (& (!= c '\n') (!= c '\r')) (push-back-character c)) )) se-word-smartz."transpose-wordLF  forward-word  backward-word *"Transpose-line"Transpose-wordde$) *L:8undo.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z (load "killring.ml") (setq-default &kill-lines-magic 1) (defun (forward-word-beginning (prefix-argument-loop (while (& (! (eobp)) (looking-at "\\w")) (forward-character)) (while (& (! (eobp)) (! (looking-at "\\w"))) (forward-character)) ) ) (backward-word-end (backward-character) (prefix-argument-loop (while (& (! (bobp)) (looking-at "\\w")) (backward-character)) (while (& (! (bobp)) (! (looking-at "\\w"))) (backward-character)) ) (if (! (bobp)) (f(defunnew-undocundowhileprognFmessage,Hit to undo more^=Bsetq6$get-tty-character  undo-boundary undo-more*$$Finished undoing.ifL&$!=^ J ,orward-character)) ) (kill-to-word-beginning (save-excursion (set-mark) (provide-prefix-argument prefix-argument (forward-word-beginning)) (kill-region))) (kill-to-word-end (save-excursion (set-mark) (provide-prefix-argument prefix-argument (forward-word)) (kill-region))) (backward-kill-to-word-beginning (save-excursion (set-mark) (provide-prefix-argument prefix-argument (backward-word)) (kill-region))) (backward-kill-to-word-end (save-excpush-back-characterranspose-Direction,&Default-Transpose-Follow,&Default-Transpose-Magic$&Column-To-Be-At&setq@\ttranspose-linefoo  transpose-upfollowEMSmark-pos Pursion (set-mark) (provide-prefix-argument prefix-argument (backward-word-end)) (kill-region))) ) P<Psave-excursion."current-column$beginning-of-line<2&bobp"@|P4 Error - Can't transpose up here.dset-mark next-line*h!@H mep  qL:9words.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z L::words.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z%6load killring.mlL setq-default$&kill-lines-magic(defun2forward-word-beginningprefix-argument-loopwhilet&,!eobp4 looking-at\w$forward-character0T$f th backward-word-end&(defun (write-region-to-file fname (setq fname (arg 1 ": write-region-to-file ")) (save-excursion (copy-region-to-buffer "write-temp") (temp-use-buffer "write-temp") (write-named-file fname) (delete-buffer "write-temp")) (novalue) ) ) !eobp4 looking-at\w$forward-character0T$f th backward-word-end&backward-characterr<0bobp 0$  r(if ~kill-to-word-beginningsave-excursionset-markRprovide-prefix-argument"prefix-argument: kill-regionbkill-to-word-end>2N,d  forward-wordpba L:;writeregion.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"zckward-kill-to-word-beginning>,  backward-wordPbackward-kill-to-word-end$Xt2-excursion."current-column$beginning-of-line<2&bobp"@|P4 Error - Can't transpose up here.dset-mark next-line*h!@H medefunwrite-region-to-filefnamefsetqHarg*: write-region-to-file save-excursionFcopy-region-to-buffer write-temp(temp-use-buffer*write-named-file& delete-buffertnovalueh backward-word-end& L::writeregion.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"zg hL:;zap.ml/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;l"z% (load "killring.ml") (setq-default &kill-lines-magic 1) (declare-global csearch-default) (defun (get-search-character newchar (setq newchar (get-tty-character)) (& (!= newchar 18) (!= newchar 19)) ; ^S or ^R repeat last search (setq csearch-default (char-to-string newchar)) csearch-default) (character-search (search-forward (get-search-character))) (reverse-character-search (search-reverse (get-search-character))) (zap-to-character (set-mark) (character-search) (backwaacter-search(search-forwardTreverse-character-search(search-reverse`zap-to-characterset-mark$&backward-character kill-region8zap-thru-characterxprefix-argument: kill-regionbkill-to-word-end>2N,d  forward-wordpbard-character) (kill-region)) (zap-thru-character (set-mark) (character-search) (kill-region)) )  r(if ~kill-to-word-beginningsave-excursionset-markRprovide-prefix-argument"prefix-argument: kill-regionbkill-to-word-end>2N,d  forward-wordpbaC/oZL9 emacs/binSSS,<.dS<TTT\l.dTUUߌ;o"zKZ;s"zK LL;zap.mo/emacs/maclibRRR .dRSSS,<.dS<TTT\l.dTUUߌ;o"z6I-@g#EJHo//NrOBNNVN^NuNV#IlN^NuNV#IN^NuNVH$.gp` 9I.I f`($g<7`<0HH./<NþX#I LN^NuNVt.NP.I/9I/<NþP./<NþX.Nþt#I#IN^NuNVt.NP.I/9I/<NþP./<NþX.Nþt#I#IN^NuNVH0*n(n t.NP Ilf$ R./<NþXm.HH/NšXRI`L0N^6load killring.mlL setq-default$&kill-lines-magicDdeclare-global"csearch-defaultdefun get-search-characternewcharBsetq$get-tty-characterL&$!=~j4v(char-to-string.LcharNuNVJoHt.NP Ilf./<NþXSm.t /NšXRI`N^NuNV$9If4$9I f`$. RIf.t/NšX`v f  f.Nþ`R f. /<NþX`4  f./<NþX`. /./<NþP# I#IN^NuNVt.NP.I/<NþX.3Nþt#Il#IIt#I#IN^NuNVt.N@t.Nrt./9INXNN^NuNVN8tt.Nt.Ntt.Ntt.N`=yEF=yEHA./<I$N8X&49EFH=Bt=BA.Nt.N,t.NFN^NuNVt.NP.ANþN^NuNVt.NP.ENþt./NXN^NuNVJn`t.NP./<JNþXN^NuNVJo $.Io-yI#IN^NuNV9I#g.PNþ` .eNþN^NuNVt #I#I|8#0{#@{#{#{#{#j|#6|#|#| #{#{#F|#X|#r|#|t#| t#|$#|(t#|,t#|0t#|4tP#|!y>JnJ|Hot#6 y}!BpL N^NuNVH8*n(n ./<HUNɦP~ Wl.$R&t( g./+/<HUNɦO &S``L8N^NuNVH0.N`*@ fp`b.HUNI NN^NuNVN8tt.Nt.Ntt.Ntt.N`=yEF=yEHA./<I$N8Xt=B4.H…=BA.Nt.N,t.NFN^NuNV.zNþ.}Nþ.Nþ.NH.I NN^NuNVH *n~gHHr./NnXԀ.` L N^NuNVH .. ntW./N@X*p g f./. NRXJg*U` L N^NuNVH0. N../. /.NP*@ g .Nj`Ft.N*@+G . N:V+@ ntW./N@XCЉ(@* nR(+n+nL0X/N8X(@ f./<N@X`.~Jl$ |J.(HTN 0XR`.NpL0N^NuNVH<.N`*@ fp`.HUNX/N8X(@ fp`./<Hn N\PJg$9f . g$E g   fB"`A .N&@`n gjA $R$Bg  gR`Jf.N@p`LB-Jg  gR`Bt./.N:VX/A $R/HSN.O `@.NpL<N^NuNV. N"Jg .4N@pN^NuNV.KN"pN^NuNVt# JJg yJ` |g#.N"#pN^NuNVH ~Jg nJfp`ƾJl4.$ |Ip/0(NRXJf$ |J 0(`R` (Jm.N@p`l.dN*@$9J |J!($9J |IpC(./.N:VX* W RJt+B~ Wl$r+(R` L N^NuNVH<. $.g |` |HP/<NךP*@ f`.,HUHnN^PA./. $.g |` |HP/<N`O (@ f`N.N:V(@$.g.N6$@ l`(f |` J.HTHn/.N.O L<N^NuNVt./</<|DNPt#6 y}!BN^NuNV#hJ# J y J##}J# J y J##J# J y J##J# 2J y J##K# K y K##K$#@K y K##K8#|K0 y K0##KL#fKD y KD##K`# jKX y KX##(Kt# Kl y Kl##9Ip#Ip|D#|DJt#JN^NuNVH<*nIg $f&L {gp`p.g:$g }gp`p` H |pN^NuNVJ>f.N@`t./<5/9>NPt#6 y}!BpN^NuNVt./<;/<|DNPpN^NuNVJ>f.BN@`t./<o/9>NPpN^NuNVH0.uNך*@ fp`P.N.HU/<|DNP(@ f./<NX`. /,/,/<NO pL0N^NuNVH0.9t-B-BA0$*BB%S mh yB.~|o y~x` y~t$0(HHr //NP W f$H |0 HHgR `.N*$9>g.HU/9>NP(@ f.HU/<|DNP(@ 0 HHgp`pg`R`B$$g$ R B` K.N*$@ g$ S(Bg`S$ggR`j(n *|KA-H n ~f n (/g nJ(f,.@N**@ gR ngR`*|E`j*ng /gR`g$ R B` M-HB$.R.Nؒ-@Jf$.R./<FN@X*|b`-n n*h ft/B*n /g [f(n ft/BB(n *n g ,/f$. Ro$ U-B n HH `bS`n n  -H HH `8U`D n  -H /f"$. o n  -H /f$. R(B` /g .g`` /g .g`X ,&/f $. RoSBpLMt y .$9f$9m$D.`($9f $9l.NDހ`#pLN^NuNVHt.N.$9l.N./NX.`#pLN^NuNVHt.N.$9fP$9lB.N,Jf$9f.uN@`$g `p./N$9~|Թ~Rm*$.Թ~l $9~` $.R%BR$j `LQD y QD##Q Q8QC#Q4QHt#Q #RQ( y QD# y"h i"y"i!it!#O# MQp y Qp##QLQdQo#Q`Qtt#QL#O QT y Qp## ^Q y Q##QxQQ#QH.9,9$9~|Թ~fmt#Rt#NR#,9N./9/NNpN^NuNVt.N>NpN^NuNVt.N>NpN^NuNVt.N>NpN^NuNV# R#>R#RJ# R#>R#R# R#>R#R# /R#>Qt#Qx#ZQ y Q# y"h i"y"i!i# gQ y Q##QQQ#QQt#Q#OQ y Q## Q y Q##QQQ#QQt#Q#^Q y Q# y"h i"y"i!i# R y R ##QRR#RR$t#Q#VR y R ## RL y RL##R(R@RK#R<RPt#R(#6R0 y RL## Rx y Rx##RTRlRwR y R## DS#?R#RJ# WS#?S y S## iS,#?(S$ y S$## {S@#?<S8 y S8#N^NuNVHt./9t /NP.|lt~|o y~x` y~t$0(  f,$S.Z/N