1 ;;; wl-mode -- Major mode for studying GRE Word Lists
3 ;; Author: Sridhar Ratna <http://srid.nfshost.com/>
5 ;; Keywords: GRE Word List major-mode
7 ;; Copyright (C) 2007 Sridhar Ratna
9 ;; This program is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU General Public License as
11 ;; published by the Free Software Foundation; either version 2 of
12 ;; the License, or (at your option) any later version.
14 ;; This program is distributed in the hope that it will be
15 ;; useful, but WITHOUT ANY WARRANTY; without even the implied
16 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17 ;; PURPOSE. See the GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public
20 ;; License along with this program; if not, write to the Free
21 ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 ;; - documentation + sample word lists (barrons)
26 ;; - custom font faces
28 (defvar wl-mode-hook nil
)
33 (subst-char-in-region (point) (+ 1 (point)) ? ch
))
35 ; Difficult word; `being' learned
36 (defun wl-mark-star ()
40 ; Difficult word; `able' to recall
41 (defun wl-mark-plus ()
45 ; Easy word; always remembering
46 (defun wl-mark-dash ()
53 (subst-char-in-region (point) (+ 1 (point)) ?
* ?
)
54 (subst-char-in-region (point) (+ 1 (point)) ?
+ ?
)
55 (subst-char-in-region (point) (+ 1 (point)) ?- ?
))
57 (defun wl-goto-random ()
61 (random (count-lines (point-min)
65 (let ((wl-mode-map (make-keymap)))
66 (define-key wl-mode-map
"\C-c\C-u" 'wl-unmark
)
67 (define-key wl-mode-map
(kbd "<f4>") 'wl-mark-star
)
68 (define-key wl-mode-map
(kbd "C-<f4>") 'wl-mark-plus
)
69 (define-key wl-mode-map
"\C-c\C-r" 'wl-mark-dash
)
70 (define-key wl-mode-map
(kbd "<f5>") 'wl-goto-random
)
72 "Keymap for WL major mode")
74 ;(add-to-list 'auto-mode-alist '("\\.wl\\'" . wl-mode))
76 (defconst wl-font-lock-keywords-1
78 '("^\\*.[a-z]+" . font-lock-keyword-face
)
79 '("^-.[a-z]+" . font-lock-comment-face
)
80 '("^+.[a-z]+" . font-lock-comment-face
)
81 '("^..[a-z]+" . font-lock-constant-face
))
82 "Highlighting for WL major mode")
84 (defvar wl-font-lock-keywords wl-font-lock-keywords-1
85 "Default highlighting expressions for WL mode")
89 "Major mode for studying GRE Word Lists"
91 (kill-all-local-variables)
92 (use-local-map wl-mode-map
)
93 (set (make-local-variable 'font-lock-defaults
) '(wl-font-lock-keywords))
94 (global-hl-line-mode 1) ;; FIXME: this is not `local' to the buffer
95 (setq major-mode
'wl-mode
)
96 (setq mode-name
"Word List")
97 (run-hooks 'wl-mode-hook
))