home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / epoch / hilit.el < prev    next >
Encoding:
Text File  |  1992-06-16  |  19.0 KB  |  562 lines

  1. ;;
  2. ;; hilit v1.3. Copyright (C) 1991 by Paul Nakada. pnakada@oracle.com
  3. ;;
  4. ;; A package allowing customizable hiliting of epoch buffers.
  5. ;;
  6. ;;
  7. ;; This file is part of GNU Emacs.
  8.  
  9. ;; LCD Archive Entry:
  10. ;; hilit|Paul Nakada|pnakada@us.oracle.com|
  11. ;; Mode switched highlighting of regions of buffers with colors and fonts.|
  12. ;; 92-04-02|v1.3|~/epoch/hilit.el.Z|
  13.  
  14. ;; HISTORY 
  15. ;; 2-Apr-1992          pnakada@oracle.com
  16. ;;   Rolled in fix from Bob Weiner for hyperbol problem.
  17. ;;   added archive version info to header.
  18. ;;   release as v1.3
  19. ;; 12-Mar-1992          pnakada@oracle.com
  20. ;;   Rolled in bug fixes from jsegal@analagous.com
  21. ;; 21-Oct-1991          pnakada@oracle.com
  22. ;;   Rolled in epoch-3.2 compatibilty.
  23. ;; 14-Oct-1991          pnakada@oracle.com
  24. ;;   Upgraded to epoch-4.0.
  25. ;;   Remove references to attributes and create global list of epoch styles. 
  26. ;;   Remove code that deals with tags.  They just were't as useful as I 
  27. ;;   thougt they would be.
  28. ;;   Added support for fonts to be specified as a style attribute.
  29. ;; 5-Sep-1991        bristor@simba    
  30. ;;   Change button-create-internal to tag buttons with 'hilit instead of with
  31. ;;   (current-buffer).  Changed unhilit-buffer to remove all buttons in the
  32. ;;   current buffer that have that tag.  Added buffer-hilited & toggle-hilit.
  33. ;;   Many renamings for consistency.  Added do-hiliting, (buffer-local)
  34. ;;   buffer-hilited, toggle-hilit.  No more use of modes; use mode-list
  35. ;;   instead.  Both patterns are regular expressions.  Access macros for
  36. ;;   pieces of a pattern.  Initialization now at load time.
  37. ;; 1-Sep-1991        bristor@simba    
  38. ;;   Simplified hilit-buffer by making it use match-{beginning,end}.
  39. ;; 30-Aug-1991        bristor@simba    
  40. ;;   Added makefile mode hiliting, mode-list, mode-update, and set-modes.
  41. ;;   These latter allow users to more easily manage the modes list, avoiding
  42. ;;   duplicate entries when adding new packages.
  43. ;; 19-Aug-1991        foo@simba    
  44. ;;   Added support for Compilation mode.  See also compile.el.
  45. ;; 24-Jul-1991        bristor@simba    
  46. ;;   Added support for Makefile mode.
  47.  
  48. ;;; GNU Emacs is distributed in the hope that it will be useful,
  49. ;;; but WITHOUT ANY WARRANTY.  No author or distributor
  50. ;;; accepts responsibility to anyone for the consequences of using it
  51. ;;; or for whether it serves any particular purpose or works at all,
  52. ;;; unless he says so in writing.  Refer to the GNU Emacs General Public
  53. ;;; License for full details.
  54.  
  55. ;;; Everyone is granted permission to copy, modify and redistribute
  56. ;;; GNU Emacs, but only under the conditions described in the
  57. ;;; GNU Emacs General Public License.   A copy of this license is
  58. ;;; supposed to have been given to you along with GNU Emacs so you
  59. ;;; can know your rights and responsibilities.  It should be in a
  60. ;;; file named COPYING.  Among other things, the copyright notice
  61. ;;; and this notice must be preserved on all copies.
  62. ;;;
  63.  
  64. ;;;
  65. ;;; This package works as follows
  66. ;;;
  67. ;;;      It can hilit regions of text specified by search expressions.
  68. ;;;      Regions are hilited as the file is read into the epoch buffer. 
  69. ;;;      When the buffer is saved, no information about these regions is saved.
  70. ;;;
  71. ;;; how I use hilit:
  72. ;;;
  73. ;;;  I basically use it to hilit different types of code.
  74. ;;;  For C source code, comments in red, function headers, prototypes in blue, 
  75. ;;;    and case labels in green.
  76. ;;;  For Lisp source code, comments in red.
  77. ;;;  For shell scripts, comments in red.
  78. ;;; 
  79. ;;;  to override default style settings, use (hilit::style-set) in your 
  80. ;;;  .emacs after loading hilit.
  81. ;;;  please look at the same .emacs file which follows
  82. ;;;
  83.  
  84. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  85. ;; Highlights regions of a file specific to a mode.  Uses variable
  86. ;; hilit::mode-list to determine what to hilit for each mode.  Each element
  87. ;; of the list has the form
  88. ;; (\"modename\" ](\"pstart\" \"pend\" attribute-num)
  89. ;;               (\"pstart\" \"pend\" attribute-num)... )
  90. ;; pstart and pend are regular expressions denoting the starting and ending
  91. ;; of a portion of the buffer to be hilited according to attribute-num.  If
  92. ;; pend is nil, the end of line terminates the region hilited.
  93. ;;
  94. ;; attribute-num is an index into hilit::attrs, not an epoch attribute.
  95. ;; Each of the entries in that table are, however, epoch attributes.
  96. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  97.  
  98.  
  99. (defvar hilit::init-done nil
  100.   "Flag signifying that pn-hilit subsystem has been initialized.")
  101.  
  102. (defvar hilit::epoch-version4 nil
  103.   "Flag indicating version 4 epoch is running.")
  104.  
  105. (defvar hilit::saving nil
  106.   "'semaphore' set while in process of saving a file.")
  107.  
  108. (defvar hilit::styles nil
  109.   "List of styles/attrs depending on epoch version.")
  110.  
  111. (defvar hilit::read-hooks nil
  112.   "List of hooks to call after visiting a file.")
  113.  
  114. (defvar hilit::write-hooks nil
  115.   "List of hooks to call before writing a file.")
  116.  
  117. (defvar hilit::mode-list nil
  118.   "A-list of mode names and regex/styles to use.")
  119.  
  120. (defvar hilit::do-hiliting t
  121.   "T if we should hilit buffers as we find 'em, nil otherwise.")
  122.  
  123. (defvar hilit::buffer-hilited nil
  124.   "Non-nil if the current buffer is hilited.")
  125.  
  126. (make-variable-buffer-local 'hilit::buffer-hilited)
  127. (setq-default hilit::buffer-hilited nil)
  128.  
  129. (defmacro pattern-start (p) (` (nth 0 (, p))))
  130. (defmacro pattern-end (p)   (` (nth 1 (, p))))
  131. (defmacro pattern-attr (p)  (` (nth 2 (, p))))
  132.  
  133.  
  134. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  135.  
  136. (defun hilit::hilit-buffer ()
  137.   "Highlights regions of a buffer specific to the buffer's mode."
  138.   (interactive)
  139.   (if hilit::mode-list
  140.       (let ((m (assoc mode-name hilit::mode-list)) (patterns))
  141.       (if (not m) 
  142.     nil                ; do nothing if we don't know the mode
  143.     (setq patterns (cdr m))
  144.     (while (setq p (car patterns))
  145.       (let ((pstart (pattern-start p))
  146.           (pend (pattern-end p))
  147.           (pattr (pattern-attr p))
  148.         )
  149.         (save-excursion
  150.           (goto-char 0)
  151.           (if pend
  152.         (while (re-search-forward pstart nil t nil)
  153.           (setq hilit::buffer-hilited t)
  154.           (goto-char (setq start (match-beginning 0)))
  155.           (if (re-search-forward pend nil t nil)
  156.             (hilit::button-create-internal
  157.               start (match-end 0) pattr nil)
  158.             (forward-char 1)    ; to avoid looping
  159.           )
  160.         )
  161.         (while (re-search-forward pstart nil t nil)
  162.           (setq hilit::buffer-hilited t)
  163.           (hilit::button-create-internal
  164.             (match-beginning 0) (match-end 0)
  165.             pattr nil)
  166.           (goto-char (match-end 0)))
  167.           )
  168.         )
  169.       )
  170.       (setq patterns (cdr patterns))
  171.     )
  172.       )
  173.     )
  174.   )
  175. )
  176.  
  177. (defun hilit::unhilit-buffer ()
  178.   "Unhilits any regions highlighted by hilit::hilit-buffer."
  179.   (interactive)
  180.   (let ((buttons (button-list))
  181.     b)
  182.     (while (setq b (car buttons))
  183.       (if (eq 'hilit (button-data b))
  184.       (delete-button b))
  185.       (setq buttons (cdr buttons)))
  186.     (setq hilit::buffer-hilited nil)))
  187.  
  188.  
  189. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  190. ;; Find/write file hooks.  They cause automatic hiliting/rehiliting when
  191. ;; files are read/written.
  192. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  193.  
  194. (defun hilit::unhilit-before-save ()
  195.   "Write a hilited buffer to a file.  Useful as a write-file hook."
  196.   (if hilit::do-hiliting
  197.       (if hilit::saving
  198.       nil
  199.     (hilit::unhilit-buffer)
  200.     (setq hilit::saving t)
  201.     (save-buffer)
  202.     (setq hilit::saving nil)
  203.     (hilit::hilit-buffer)
  204.     (set-buffer-modified-p nil)
  205.     t)))
  206.  
  207. (defun hilit::hilit-after-find ()
  208.   "Hilit the current buffer, without modifying it.  Useful as a find-file hook."
  209.   (if hilit::do-hiliting
  210.       (progn
  211.         (hilit::hilit-buffer)
  212.         (set-buffer-modified-p nil))))
  213.  
  214.  
  215. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  216. ;; Button creating and deleting.
  217. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  218.  
  219. (defun hilit::button-clear-internal (start end)
  220.   "Clear all epoch buttons between START and END."
  221.   (let ((pos start button))
  222.     (while (/= end pos)
  223.       (epoch::delete-button-at pos (current-buffer))
  224.       (setq pos (+ 1 pos)))))
  225.  
  226. (defun hilit::button-create-internal (start end styleindex nuke) 
  227.   "Put a hilit button on the region from START to END having ATTR; if
  228. NUKE then clear any buttons already in that region."
  229.   (if nuke 
  230.       (hilit::button-clear-internal start end))
  231.   (epoch::add-button start end (nth styleindex hilit::styles) 'hilit))
  232.  
  233.  
  234. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  235. ;; To add a new mode to the hilit list, call hilit::mode-list-update.
  236. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  237.  
  238. (defun hilit::mode-list-update (mode-name mode-list)
  239.   "Adds or updates the hiliting instructions for MODE-NAME in MODE-LIST to the
  240. hiliting mode list."
  241.   (if (assoc mode-name hilit::mode-list)
  242.       (setq hilit::mode-list
  243.         (delete-if '(lambda (x) (equal (car x) mode-name))
  244.                hilit::mode-list)))
  245.   (setq hilit::mode-list (cons (cons mode-name mode-list)
  246.                                hilit::mode-list)))
  247.  
  248.  
  249. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  250. ;; To set a style, call hilit::style-set
  251. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  252. (defun hilit::style-set (styleindex foreground background font)
  253.   "set the foreground, background, and/or font of a given hilit style"
  254.   (let ((style (nth styleindex hilit::styles)))
  255.     (if style
  256.         (if hilit::epoch-version4
  257.             (progn
  258.               (if foreground
  259.                   (set-style-foreground style foreground))
  260.               (if background
  261.                   (set-style-background style background))
  262.               (if font
  263.                   (set-style-font style font)))))))
  264.  
  265.  
  266. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  267. ;; User interface cruft
  268. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  269.  
  270. (defun hilit::re-hilit (arg)
  271.   "Re-hilit the current buffer.  With arg, unhilit the current buffer."
  272.   (interactive "P")
  273.   (hilit::unhilit-buffer)
  274.   (setq hilit::buffer-hilited nil)
  275.   (if (not arg)
  276.       (hilit::hilit-buffer))
  277.   )
  278.  
  279. (global-set-key "\C-c\C-h" 'hilit::re-hilit)
  280.  
  281. (defun hilit::toggle-hilit (arg)
  282.   "Globally toggle hiliting of this and future files read.  With arg,
  283. forces hiliting off."
  284.   (interactive "P")
  285.   (if arg
  286.       (progn
  287.     (setq hilit::buffer-hilited nil)
  288.     (setq hilit::do-hiliting t))
  289.     (setq hilit::buffer-hilited (not hilit::buffer-hilited))
  290.     )
  291.   (setq hilit::do-hiliting hilit::buffer-hilited)
  292.   (hilit::unhilit-buffer)
  293.   (if hilit::do-hiliting
  294.       (hilit::hilit-buffer))
  295.   (message (format "Hiliting is %s"
  296.            (if hilit::buffer-hilited
  297.                "on" "off")))
  298.   )
  299.  
  300. (global-set-key "\C-c\C-t" 'hilit::toggle-hilit)
  301.  
  302.  
  303. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  304. ;; Initialization.  
  305. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  306.  
  307. (if (not hilit::init-done)
  308.     (progn
  309.       (if (boundp 'hyperb:version)
  310.           (var:append 'find-file-hooks '(hilit::hilit-after-find))
  311.         (push 'hilit::hilit-after-find find-file-hooks))
  312.       (push 'hilit::unhilit-before-save write-file-hooks)
  313.  
  314.       (setq hilit::epoch-version4 
  315.             (string-match " 4" epoch::version))
  316.  
  317.       (if (not hilit::epoch-version4)
  318.           ;; version 3 init code
  319.           (setq hilit::styles (reserve-attributes 20)))
  320.  
  321.       (mapcar '(lambda (a) 
  322.                  ;; version 4 init code
  323.                  (if hilit::epoch-version4
  324.                      (let (style)
  325.                        (setq style (make-style))
  326.                        (setq hilit::styles (cons style hilit::styles))
  327.                        (if (cadr a)
  328.                            (set-style-foreground style (cadr a))
  329.                          (set-style-foreground style (foreground)))
  330.                        (set-style-background style (background))
  331.                        (if (caddr a)
  332.                            (set-style-font style (caddr a))))
  333.  
  334.                    ;; version 3 init code
  335.                    (set-attribute-global
  336.                     (nth (car a) hilit::styles)
  337.                     (if (cadr a)
  338.                         (get-color (cadr a))
  339.                       (foreground))
  340.                     (background))))
  341.  
  342.               '((0 "red" nil)
  343.                 (1 "magenta" nil )
  344.                 (2 "blue" nil)
  345.                 (3 "purple" nil)
  346.                 (4 "RoyalBlue" nil)
  347.                 (5 "DarkGoldenrod" nil)
  348.                 (6 "firebrick" nil)
  349.                 (7 "DarkOrange" nil)
  350.                 (8 "DeepPink" nil)
  351.                 (9 "ForestGreen" nil)
  352.                 (10 nil nil)
  353.                 (11 nil nil)
  354.                 (12 nil nil)
  355.                 (13 nil nil)
  356.                 (14 nil nil)
  357.                 (15 nil nil)
  358.                 (16 nil nil)
  359.                 (17 nil nil)
  360.                 (18 nil nil)
  361.                 (19 nil nil)))
  362.  
  363.       (if hilit::epoch-version4
  364.           ;; version 4 init code
  365.           (setq hilit::styles (reverse hilit::styles)))
  366.  
  367.       (setq hilit::init-done t)))
  368.  
  369.  
  370. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  371. ;; Built-in support for various modes.
  372. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  373.  
  374. (setq c-mode-hilit
  375.       '(("/\\*" "\\*/" 0)
  376.     ("^[_a-zA-Z][^=\n]*(\\(.*;\\|[^{]*\\)" nil 2) ;; fn decls
  377.     ("^#.*" nil 9)
  378.     ("^typedef.*" nil 1)
  379.     ("^struct.*" nil 1)
  380.     ("^enum.*" nil 1)))
  381. (hilit::mode-list-update "C" c-mode-hilit)
  382.  
  383. (setq c++-mode-hilit
  384.       '(("/\\*" "\\*/" 0)
  385.     ("^[_a-zA-Z][^=\n]*(\\(.*;\\|[^{]*\\)" nil 2) ;; fn decls
  386.     ("//.*" nil 0)
  387.     ("^/.*" nil 0)
  388.     ("^#.*" nil 9)
  389.     ("^typedef.*" nil 1)
  390.     ("^struct.*" nil 1)
  391.     ("^class.*" nil 1)
  392.     ("^enum.*" nil 1)))
  393. (hilit::mode-list-update "C++" c++-mode-hilit)
  394.  
  395. (setq text-mode-hilit
  396.       '(("^#.*" nil 0)
  397.         ("[^$]#.*" nil 0)))
  398. (hilit::mode-list-update "Text" text-mode-hilit)
  399.  
  400. (setq fundamental-mode-hilit
  401.       '(("^#.*" nil 0)
  402.         ("[^$]#.*" nil 0)))
  403. (hilit::mode-list-update "Fundamental" fundamental-mode-hilit)
  404.  
  405. (setq compilation-mode-hilit
  406.       '(("^[^ \t]*:[0-9]+:.*$" nil 0)
  407.         ("^[^ \t]*:[0-9]+: warning:.*$" nil 2)))
  408. (hilit::mode-list-update "Compilation" compilation-mode-hilit)
  409. (hilit::mode-list-update "grep" compilation-mode-hilit)
  410.  
  411. (setq makefile-mode-hilit
  412.       '(("^#.*" nil 0)            ; comments
  413.     ("[^$]#.*" nil 0)        ; comments
  414.     ("^%.*" nil 1)            ; rules
  415.     ("^[.][a-zA-Z][a-zA-Z]?\..*" nil 1) ; rules
  416.     ("^[_a-zA-Z0-9]+ *\+?=" nil 2)    ; variable definition
  417.     ("\$[_a-zA-Z0-9]" nil 2)    ; variable reference
  418.     ("\${[_a-zA-Z0-9]+}" nil 2)    ; variable reference
  419.     ("\$\([_a-zA-Z0-9]+\)" nil 2)    ; variable reference
  420.     ("\\( \\|:=\\)[_a-zA-Z0-9]+ *\\+=" nil 2) ; variable definition
  421.     ("^include " nil 9)        ; include
  422.     ))
  423. (hilit::mode-list-update "Makefile" makefile-mode-hilit)
  424.  
  425. (setq emacs-lisp-mode-hilit
  426.       '(("^;.*" nil 0)
  427.     (";;.*" nil 0)
  428.     ("\(defun.*" nil 2)
  429.     ("\(defmacro.*" nil 7)
  430.     ("\(defvar.*" nil 1)
  431.     ("\(defconst.*" nil 5)
  432.     ("\(provide.*" nil 9)
  433.     ("\(require.*" nil 9)))
  434. (hilit::mode-list-update "Emacs-Lisp" emacs-lisp-mode-hilit)
  435.  
  436. (provide 'hilit)
  437.  
  438. ;;
  439. ;; the following is the epoch specific portion of my .emacs file
  440. ;;
  441. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  442. ;;; do any epoch-dependent processing here
  443. ;;; running-epoch is a better name for the variable that tells us is we are
  444. ;;; in epoch or not
  445. ;(defvar running-epoch (boundp 'epoch::version))
  446. ;
  447. ;(if running-epoch
  448. ;
  449. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  450. ;;; figure out which version of epoch is running
  451. ;;;    
  452. ;    (let (version4)
  453. ;      (setq version4 (not (string= epoch::version "Epoch 3.2.1")))
  454. ;
  455. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  456. ;;; Load epoch elisp code.  Most/all of this should have been loaded at the
  457. ;;; time epoch was dumped.  Load any of these files if necessary.  Change
  458. ;;; these "require" statements to "load-file" to pick up local changes to
  459. ;;; standard code that was dumped.
  460. ;;;
  461. ;      (require 'mini-cl)
  462. ;      (require 'wrapper)
  463. ;      (require 'epoch-util)
  464. ;      (require 'epoch)    
  465. ;      (require 'event)
  466. ;      (require 'mouse)
  467. ;      (require 'motion)
  468. ;      (require 'property)
  469. ;      (require 'button)
  470. ;      (if version4
  471. ;          (require 'selection))
  472. ;      (require 'message)
  473. ;      (if (not version4)
  474. ;          (progn
  475. ;            (require 'server)))        ;; not dumped - this will always load
  476. ;
  477. ;      (if version4
  478. ;          (setq load-path
  479. ;                (append
  480. ;                 (list "/tools/libsun4-os4/epoch-4.0/contrib/hyper/")
  481. ;                 load-path))
  482. ;        (setq load-path
  483. ;              (append
  484. ;               (list "/tools/libsun4-os4/epoch-3.2/contrib/hyper/")
  485. ;               load-path)))
  486. ;            
  487. ;      (setq term-file-prefix nil)  ;; don't load xterm stuff!
  488. ;      (setq auto-raise-screen nil) ;; don't autoraise
  489. ;
  490. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  491. ;;; set inverse selection style
  492. ;;;
  493. ;      (set-style-underline  motion::style nil)
  494. ;      (set-style-foreground motion::style (foreground))
  495. ;      (set-style-background motion::style "grey85")
  496. ;
  497. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  498. ;;; for monochrome users only
  499. ;;;      (set-style-underline  motion::style nil)
  500. ;;;      (set-style-foreground motion::style (background))
  501. ;;;      (set-style-background motion::style (foreground))
  502. ;;; 
  503. ;
  504. ;;; hyperinfo stuff
  505. ;      (load "info"     )
  506. ;      (load "hyper-man")
  507. ;
  508. ;;; color hilighting stuff
  509. ;      (if version4
  510. ;          (load "hilit")
  511. ;        (load "hilit"))
  512. ;
  513.  
  514. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  515. ;;; pl/sql mode hilit info  (how to add a hilit mode)
  516. ;;;
  517. ;      (if version4
  518. ;          (progn
  519. ;            (setq ada-mode-hilit
  520. ;                  '(("--.*" nil 0)
  521. ;                    ("^[ \t]*function.*" nil 2)
  522. ;                    ("^[ \t]*procedure.*" nil 2)))
  523. ;            (hilit::mode-list-update "Ada" ada-mode-hilit)))
  524. ;
  525. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  526. ;;; gnus modes hilit info
  527. ;;;
  528. ;      (if version4
  529. ;          (progn
  530. ;            (hilit::style-set 0 nil nil "fixed")
  531. ;            (setq gnus-article-mode-hilit
  532. ;                  '(("^Subject: .*" nil 10)))
  533. ;            (hilit::mode-list-update "Article" gnus-article-mode-hilit)
  534. ;            (setq gnus-subject-mode-hilit
  535. ;                  '(("^D.*" nil 11)
  536. ;                    (".*\\+\\[.*" nil 10)))
  537. ;            (hilit::mode-list-update "Subject" gnus-subject-mode-hilit)
  538. ;            (hilit::style-set 10 "red" (background) nil)
  539. ;            (hilit::style-set 11 "grey75" (background) nil)))
  540. ;
  541. ;            
  542. ;      (if version4
  543. ;          (progn
  544. ;            (setq gnus-Subject-prepare-hook
  545. ;                  '(lambda ()
  546. ;                     (hilit::hilit-buffer)))
  547. ;            (setq gnus-Article-prepare-hook
  548. ;                  '(lambda ()
  549. ;                     (hilit::hilit-buffer)))
  550. ;            (setq gnus-Mark-article-hook
  551. ;                  '(lambda nil 
  552. ;                     (let ((cb (current-buffer)))
  553. ;                       (or (memq gnus-current-article gnus-newsgroup-marked) 
  554. ;                           (gnus-Subject-mark-as-read gnus-current-article))
  555. ;                       (gnus-Subject-set-current-mark "+")
  556. ;                       (switch-to-buffer gnus-Subject-buffer)
  557. ;                       (hilit::hilit-buffer)
  558. ;                       (switch-to-buffer cb))))))
  559. ;))
  560.  
  561.  
  562.