63
63
64
64
(defun sdml-mode-ctags-tag-file-path (&optional file-path )
65
65
" Return a path to a tag file for the current buffer.
66
- If FILE-PATH is provided the tag file is found relative to that
67
- path instead."
66
+
67
+ If FILE-PATH is not provided the file name of the current buffer is used
68
+ instead.
69
+
70
+ If the `company-ctags' package is loaded, use the function
71
+ `company-ctags-find-table' to find a tag file location.
72
+
73
+ If the `projectile' package is loaded, use the variable
74
+ `projectile-project-root' to determine the directory in which to
75
+ put the tag file named `sdml-mode-ctags-output-file-name' .
76
+
77
+ If neither of these are present the directory containing FILE-NAME
78
+ will be used as the location for the tag file named
79
+ `sdml-mode-ctags-output-file-name' ."
68
80
(let* ((current-buffer-dir (file-name-directory
69
81
(or file-path (buffer-file-name ))))
70
82
(fallback (concat current-buffer-dir
@@ -78,29 +90,47 @@ path instead."
78
90
(t fallback))))
79
91
80
92
(defun sdml-mode-ctags-generate ()
81
- " Generate a TAGS file for the current SDML project."
93
+ " Generate a TAGS file for the current SDML project.
94
+
95
+ This command executes the Universal Ctags executable specified in
96
+ `sdml-mode-ctags-command' to create a tag file determined by the
97
+ function `sdml-mode-ctags-tag-file-path' ."
82
98
(interactive )
83
99
(let ((tag-file-path (sdml-mode-ctags-tag-file-path)))
84
100
(shell-command (format " %s -R -e -o %s " sdml-mode-ctags-command tag-file-path))))
85
101
102
+
103
+ ; ; --------------------------------------------------------------------------
104
+ ; ; Key Bindings
105
+ ; ; --------------------------------------------------------------------------
106
+
107
+ (defvar sdml-mode-ctags-mode-map
108
+ (let ((map (make-sparse-keymap )))
109
+ (define-key map (kbd " C-c C-s g" ) 'sdml-mode-ctags-generate ))
110
+ " Key map for SDML ctags minor mode." )
111
+
112
+
86
113
; ; --------------------------------------------------------------------------
87
114
; ; Ctags Minor Mode
88
115
; ; --------------------------------------------------------------------------
89
116
90
117
;;;### autoload
91
118
(define-minor-mode
92
119
sdml-mode-ctags-mode
93
- " Minor mode to provide tagging of SDML source."
120
+ " Minor mode to provide tagging of SDML source.
121
+
122
+ Key bindings:
123
+ \\ {sdml-mode-ctags-mode-map}"
94
124
95
125
:group 'sdml
96
126
97
127
:tag " Enable SDML tagging minor mode"
98
128
99
129
:lighter nil
100
130
101
- (let (( map ( make-sparse-keymap )))
102
- ( define-key map ( kbd " C-c C-s T " ) 'sdml-mode-ctags-generate )
103
- ( add-to-list 'minor-mode-map-alist ( cons ' sdml-mode-ctags-mode map) ))
131
+ (add-to-list 'minor-mode-map-alist
132
+ ( cons 'sdml-mode-ctags-mode
133
+ sdml-mode-ctags-mode- map))
104
134
105
135
(when (featurep 'company-ctags )
106
136
(add-to-list 'company-ctags-modes 'sdml-mode )))
0 commit comments