/[climacs]/climacs/java-syntax-commands.lisp
ViewVC logotype

Contents of /climacs/java-syntax-commands.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Fri Dec 21 11:22:50 2007 UTC (6 years, 3 months ago) by thenriksen
Branch: MAIN
Changes since 1.3: +3 -3 lines
Fixed undeclared variable error for a Java syntax command.
1 ;;; -*- Mode: Lisp; Package: CLIMACS-JAVA-SYNTAX; -*-
2
3 ;;; (c) copyright 2004-2005 by
4 ;;; Robert Strandh (strandh@labri.fr)
5 ;;; (c) copyright 2004-2005 by
6 ;;; Elliott Johnson (ejohnson@fasl.info)
7 ;;; (c) copyright 2005 by
8 ;;; Matthieu Villeneuve (matthieu.villeneuve@free.fr)
9 ;;; (c) copyright 2005 by
10 ;;; Aleksandar Bakic (a_bakic@yahoo.com)
11 ;;; (c) copyright 2006 by
12 ;;; Troels Henriksen (athas@sigkill.dk)
13 ;;; (c) copyright 2007 by
14 ;;; John Q. Splittist (splittist@splittist.com)
15 ;;;
16 ;;; This library is free software; you can redistribute it and/or
17 ;;; modify it under the terms of the GNU Library General Public
18 ;;; License as published by the Free Software Foundation; either
19 ;;; version 2 of the License, or (at your option) any later version.
20 ;;;
21 ;;; This library is distributed in the hope that it will be useful,
22 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 ;;; Library General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU Library General Public
27 ;;; License along with this library; if not, write to the
28 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29 ;;; Boston, MA 02111-1307 USA.
30
31 ;;; Commands specific to the Java syntax for Climacs.
32
33 (in-package :climacs-java-syntax)
34
35 ;;; This command table is used when Drei runs as a pane.
36 (make-command-table 'pane-java-table
37 :errorp nil)
38
39 (defmethod additional-command-tables append ((drei drei-pane)
40 (command-table java-table))
41 '(pane-java-table))
42
43 ;; Movement commands.
44 (drei-commands:define-motion-commands expression java-table)
45 ;; (drei-commands:define-motion-commands definition java-table)
46 (drei-commands:define-motion-commands up java-table
47 :noun "nesting level up"
48 :plural "levels")
49 (drei-commands:define-motion-commands down java-table
50 :noun "nesting level down"
51 :plural "levels")
52 (drei-commands:define-motion-commands list java-table)
53
54 (drei-commands:define-editing-commands expression java-table)
55 (drei-commands:define-deletion-commands expression java-table)
56
57 (define-command (com-fill-paragraph :name t :command-table java-table)
58 ()
59 "Fill paragraph at point. Will have no effect unless there is a
60 string at point."
61 (let* ((token (form-around (current-syntax) (offset (point))))
62 (fill-column (auto-fill-column (current-view))))
63 (when (typep token 'string-form)
64 (with-accessors ((offset1 start-offset)
65 (offset2 end-offset)) token
66 (fill-region (make-buffer-mark (current-buffer) offset1 :right)
67 (make-buffer-mark (current-buffer) offset2 :right)
68 #'(lambda (mark)
69 (syntax-line-indentation
70 mark (tab-space-count (current-view)) (current-syntax)))
71 fill-column
72 (tab-space-count (current-view))
73 (current-syntax)
74 t)))))
75
76 (define-command (com-indent-expression :name t :command-table java-table)
77 ((count 'integer :prompt "Number of expressions"))
78 (let* ((mark (clone-mark (point))))
79 (if (plusp count)
80 (loop repeat count do (forward-expression mark (current-syntax)))
81 (loop repeat (- count) do (backward-expression mark (current-syntax))))
82 (indent-region *drei-instance* (point) mark)))
83
84 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
85 ;;;
86 ;;; Gesture bindings
87
88 (set-key 'com-fill-paragraph
89 'java-table
90 '((#\q :meta)))
91
92 (set-key `(com-indent-expression ,*numeric-argument-marker*)
93 'java-table
94 '((#\q :meta :control)))
95
96 (set-key `(com-backward-up ,*numeric-argument-marker*)
97 'java-table
98 '((#\u :control :meta)))
99
100 (set-key `(com-forward-down ,*numeric-argument-marker*)
101 'java-table
102 '((#\d :control :meta)))
103
104 (set-key `(com-backward-expression ,*numeric-argument-marker*)
105 'java-table
106 '((#\b :control :meta)))
107
108 (set-key `(com-forward-expression ,*numeric-argument-marker*)
109 'java-table
110 '((#\f :control :meta)))
111
112 ;; (set-key `(com-backward-definition ,*numeric-argument-marker*)
113 ;; 'java-table
114 ;; '((#\a :control :meta)))
115
116 ;; (set-key `(com-forward-definition ,*numeric-argument-marker*)
117 ;; 'java-table
118 ;; '((#\e :control :meta)))
119
120 (set-key `(com-forward-list ,*numeric-argument-marker*)
121 'java-table
122 '((#\n :control :meta)))
123
124 (set-key `(com-backward-list ,*numeric-argument-marker*)
125 'java-table
126 '((#\p :control :meta)))
127
128 (set-key `(com-kill-expression ,*numeric-argument-marker*)
129 'java-table
130 '((#\k :control :meta)))
131
132 (set-key `(com-transpose-expressions)
133 'java-table
134 '((#\t :control :meta)))

  ViewVC Help
Powered by ViewVC 1.1.5