annotate lisp/cedet/srecode/filters.el @ 106283:85d22dbf4301

(describe-bindings-internal): Remove `interactive'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 27 Nov 2009 04:24:47 +0000
parents 7f4c7f5c0eba
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104498
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; srecode/filters.el --- Filters for use in template variables.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; Various useful srecoder template functions.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;;; Code:
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 (require 'newcomment)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 (require 'srecode/table)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 (require 'srecode/insert)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (defun srecode-comment-prefix (str)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 "Prefix each line of STR with the comment prefix characters."
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 (let* ((dict srecode-inserter-variable-current-dictionary)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; Derive the comment characters to put in front of each line.
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 (cs (or (and dict
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (srecode-dictionary-lookup-name dict "comment_prefix"))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (and comment-multi-line comment-continue)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (and (not comment-multi-line) comment-start)))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (strs (split-string str "\n"))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (newstr "")
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 )
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (while strs
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (cond ((and (not comment-multi-line) (string= (car strs) ""))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ; (setq newstr (concat newstr "\n")))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 )
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (t
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (setq newstr (concat newstr cs " " (car strs)))))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (setq strs (cdr strs))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (when strs (setq newstr (concat newstr "\n"))))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 newstr))
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (provide 'srecode/filters)
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ;;; srecode/filters.el ends here
41dc39934483 lisp/cedet/srecode.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 104498
diff changeset
57 ;; arch-tag: fcc95ddc-8d9a-4b15-bb51-2707ead986c7