comparison lisp/modes/scribe.el @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents 376386a54a3c
children
comparison
equal deleted inserted replaced
188:e29a8e7498d9 189:489f57a838ef
1 ;;; scribe.el --- scribe mode, and its idiosyncratic commands. 1 ;;; scribe.el --- scribe mode, and its idiosyncratic commands.
2 ;; Keywords: wp 2 ;; Keywords: wp
3 3
4 ;; Copyright (C) 1985 Free Software Foundation, Inc. 4 ;; Copyright (C) 1985 Free Software Foundation, Inc.
5 5
6 ;; This file might become part of GNU Emacs. 6 ;; This file is part of XEmacs.
7 7
8 ;; GNU Emacs is distributed in the hope that it will be useful, 8 ;; GNU Emacs is distributed in the hope that it will be useful,
9 ;; but without any warranty. No author or distributor 9 ;; but without any warranty. No author or distributor
10 ;; accepts responsibility to anyone for the consequences of using it 10 ;; accepts responsibility to anyone for the consequences of using it
11 ;; or for whether it serves any particular purpose or works at all, 11 ;; or for whether it serves any particular purpose or works at all,
17 ;; of the document is supposed to have been given to you along with 17 ;; of the document is supposed to have been given to you along with
18 ;; GNU Emacs so that you can know how you may redistribute it all. 18 ;; GNU Emacs so that you can know how you may redistribute it all.
19 ;; It should be in a file named COPYING. Among other things, the 19 ;; It should be in a file named COPYING. Among other things, the
20 ;; copyright notice and this notice must be preserved on all copies. 20 ;; copyright notice and this notice must be preserved on all copies.
21 21
22 (defgroup scribe nil
23 "Scribe mode, and its idiosyncratic commands."
24 :group 'wp)
25
22 26
23 (defvar scribe-mode-syntax-table nil 27 (defvar scribe-mode-syntax-table nil
24 "Syntax table used while in scribe mode.") 28 "Syntax table used while in scribe mode.")
25 29
26 (defvar scribe-mode-abbrev-table nil 30 (defvar scribe-mode-abbrev-table nil
27 "Abbrev table used while in scribe mode.") 31 "Abbrev table used while in scribe mode.")
28 32
29 (defvar scribe-fancy-paragraphs nil 33 (defcustom scribe-fancy-paragraphs nil
30 "*Non-NIL makes Scribe mode use a different style of paragraph separation.") 34 "*Non-NIL makes Scribe mode use a different style of paragraph separation."
31 35 :type 'boolean
32 (defvar scribe-electric-quote nil 36 :group 'scribe)
33 "*Non-NIL makes insert of double quote use `` or '' depending on context.") 37
34 38 (defcustom scribe-electric-quote nil
35 (defvar scribe-electric-parenthesis nil 39 "*Non-NIL makes insert of double quote use `` or '' depending on context."
40 :type 'boolean
41 :group 'scribe)
42
43 (defcustom scribe-electric-parenthesis nil
36 "*Non-NIL makes parenthesis char ( (]}> ) automatically insert its close 44 "*Non-NIL makes parenthesis char ( (]}> ) automatically insert its close
37 if typed after an @Command form.") 45 if typed after an @Command form."
46 :type 'boolean
47 :group 'scribe)
38 48
39 (defconst scribe-open-parentheses "[({<" 49 (defconst scribe-open-parentheses "[({<"
40 "Open parenthesis characters for Scribe.") 50 "Open parenthesis characters for Scribe.")
41 51
42 (defconst scribe-close-parentheses "])}>" 52 (defconst scribe-close-parentheses "])}>"
148 158
149 (defun scribe-envelop-word (string count) 159 (defun scribe-envelop-word (string count)
150 "Surround current word with Scribe construct @STRING[...]. COUNT 160 "Surround current word with Scribe construct @STRING[...]. COUNT
151 specifies how many words to surround. A negative count means to skip 161 specifies how many words to surround. A negative count means to skip
152 backward." 162 backward."
153 (let ((spos (point)) (epos (point)) (ccoun 0) noparens) 163 (let ((spos (point)) (epos (point)) (ccoun 0))
154 (if (not (zerop count)) 164 (if (not (zerop count))
155 (progn (if (= (char-syntax (preceding-char)) ?w) 165 (progn (if (= (char-syntax (preceding-char)) ?w)
156 (forward-sexp (min -1 count))) 166 (forward-sexp (min -1 count)))
157 (setq spos (point)) 167 (setq spos (point))
158 (if (looking-at (concat "@\\w[" scribe-open-parentheses "]")) 168 (if (looking-at (concat "@\\w[" scribe-open-parentheses "]"))