Skip to content

Commit 56e21f8

Browse files
committed
Simplify autoloads
1 parent 7d9aabb commit 56e21f8

File tree

6 files changed

+23
-46
lines changed

6 files changed

+23
-46
lines changed

swift-mode-beginning-of-defun.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
(require 'swift-mode-lexer)
4646
(require 'swift-mode-indent)
4747

48-
;;;###autoload
4948
(defcustom swift-mode:mark-defun-preference 'containing
5049
"Preference for `swift-mode:mark-defun' for nested declarations.
5150

swift-mode-font-lock.el

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,117 +44,99 @@
4444
"Font faces."
4545
:group 'swift)
4646

47-
;;;###autoload
4847
(defcustom swift-mode:highlight-symbols-in-standard-library
4948
t
5049
"Highlight symbols in the standard library."
5150
:type 'boolean
5251
:group 'swift-mode:faces
5352
:safe 'booleanp)
5453

55-
;;;###autoload
5654
(defcustom swift-mode:highlight-symbols-in-foundation-framework
5755
t
5856
"Highlight symbols in the Foundation framework."
5957
:type 'boolean
6058
:group 'swift-mode:faces
6159
:safe 'booleanp)
6260

63-
;;;###autoload
6461
(defface swift-mode:constant-keyword-face
6562
'((t . (:inherit font-lock-constant-face)))
6663
"Face for highlighting constant keywords
6764
6865
That is, true, false, and nil."
6966
:group 'swift-mode:faces)
7067

71-
;;;###autoload
7268
(defface swift-mode:preprocessor-keyword-face
7369
'((t . (:inherit font-lock-preprocessor-face)))
7470
"Face for highlighting preprocessor keywords.
7571
7672
Example: #if, #endif, and #selector."
7773
:group 'swift-mode:faces)
7874

79-
;;;###autoload
8075
(defface swift-mode:keyword-face
8176
'((t . (:inherit font-lock-keyword-face)))
8277
"Face for highlighting keywords."
8378
:group 'swift-mode:faces)
8479

85-
;;;###autoload
8680
(defface swift-mode:builtin-method-trailing-closure-face
8781
'((t . (:inherit font-lock-builtin-face)))
8882
"Face for highlighting builtin methods with trailing closure."
8983
:group 'swift-mode:faces)
9084

91-
;;;###autoload
9285
(defface swift-mode:builtin-method-face
9386
'((t . (:inherit font-lock-builtin-face)))
9487
"Face for highlighting builtin methods."
9588
:group 'swift-mode:faces)
9689

97-
;;;###autoload
9890
(defface swift-mode:builtin-function-trailing-closure-face
9991
'((t . (:inherit font-lock-builtin-face)))
10092
"Face for highlighting builtin functions with trailing closure."
10193
:group 'swift-mode:faces)
10294

103-
;;;###autoload
10495
(defface swift-mode:builtin-function-face
10596
'((t . (:inherit font-lock-builtin-face)))
10697
"Face for highlighting builtin functions."
10798
:group 'swift-mode:faces)
10899

109-
;;;###autoload
110100
(defface swift-mode:builtin-property-face
111101
'((t . (:inherit font-lock-builtin-face)))
112102
"Face for highlighting builtin properties."
113103
:group 'swift-mode:faces)
114104

115-
;;;###autoload
116105
(defface swift-mode:builtin-constant-face
117106
'((t . (:inherit font-lock-builtin-face)))
118107
"Face for highlighting builtin constants."
119108
:group 'swift-mode:faces)
120109

121-
;;;###autoload
122110
(defface swift-mode:builtin-enum-case-face
123111
'((t . (:inherit font-lock-builtin-face)))
124112
"Face for highlighting builtin enum cases."
125113
:group 'swift-mode:faces)
126114

127-
;;;###autoload
128115
(defface swift-mode:build-config-keyword-face
129116
'((t . (:inherit font-lock-builtin-face)))
130117
"Face for highlighting build configuration keywords."
131118
:group 'swift-mode:faces)
132119

133-
;;;###autoload
134120
(defface swift-mode:builtin-type-face
135121
'((t . (:inherit font-lock-builtin-face)))
136122
"Face for highlighting builtin types."
137123
:group 'swift-mode:faces)
138124

139-
;;;###autoload
140125
(defface swift-mode:builtin-precedence-group-face
141126
'((t . (:inherit font-lock-builtin-face)))
142127
"Face for highlighting builtin precedence groups."
143128
:group 'swift-mode:faces)
144129

145-
;;;###autoload
146130
(defface swift-mode:function-call-face
147131
'((t . (:inherit font-lock-function-name-face)))
148132
"Face for highlighting function calls."
149133
:group 'swift-mode:faces)
150134

151-
;;;###autoload
152135
(defface swift-mode:function-name-face
153136
'((t . (:inherit font-lock-function-name-face)))
154137
"Face for highlighting function names."
155138
:group 'swift-mode:faces)
156139

157-
;;;###autoload
158140
(defface swift-mode:property-access-face
159141
'((t . (:inherit font-lock-variable-name-face)))
160142
"Face for highlighting property accesses."

swift-mode-imenu.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"Imenu."
3737
:group 'swift)
3838

39-
;;;###autoload
4039
(defcustom swift-mode:imenu-style
4140
'nested
4241
"Style of Imenu hierarchy.

swift-mode-indent.el

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,63 +36,54 @@
3636

3737
;;; Customizations
3838

39-
;;;###autoload
4039
(defcustom swift-mode:basic-offset 4
4140
"Amount of indentation for block contents."
4241
:type 'integer
4342
:group 'swift
4443
:safe 'integerp)
4544

46-
;;;###autoload
4745
(defcustom swift-mode:parenthesized-expression-offset 2
4846
"Amount of indentation inside parentheses and square brackets."
4947
:type 'integer
5048
:group 'swift
5149
:safe 'integerp)
5250

53-
;;;###autoload
5451
(defcustom swift-mode:multiline-statement-offset 2
5552
"Amount of indentation for continuations of expressions."
5653
:type 'integer
5754
:group 'swift
5855
:safe 'integerp)
5956

60-
;;;###autoload
6157
(defcustom swift-mode:switch-case-offset 0
6258
"Amount of indentation for case labels in switch statements."
6359
:type 'integer
6460
:group 'swift
6561
:safe 'integerp)
6662

67-
;;;###autoload
6863
(defcustom swift-mode:prepend-asterisk-to-comment-line nil
6964
"Automatically insert a asterisk to each comment line if non-nil."
7065
:type 'boolean
7166
:group 'swift
7267
:safe 'booleanp)
7368

74-
;;;###autoload
7569
(defcustom swift-mode:insert-space-after-asterisk-in-comment t
7670
"Automatically insert a space after asterisk in comment if non-nil."
7771
:type 'boolean
7872
:group 'swift
7973
:safe 'booleanp)
8074

81-
;;;###autoload
8275
(defcustom swift-mode:auto-close-multiline-comment t
8376
"If non-nil, `indent-new-comment-line' automatically close multiline comment."
8477
:type 'boolean
8578
:group 'swift
8679
:safe 'booleanp)
8780

88-
;;;###autoload
8981
(defcustom swift-mode:fix-comment-close t
9082
"Fix \"* /\" in incomplete multiline comment to \"*/\" if non-nil."
9183
:type 'boolean
9284
:group 'swift
9385
:safe 'booleanp)
9486

95-
;;;###autoload
9687
(defcustom swift-mode:highlight-anchor nil
9788
"Highlight anchor point for indentation if non-nil.
9889

swift-mode-repl.el

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@
4545
"REPL."
4646
:group 'swift)
4747

48-
;;;###autoload
4948
(defcustom swift-mode:repl-executable
5049
(concat (when (executable-find "xcrun") "xcrun ") "swift")
5150
"Path to the Swift CLI. The string is split by spaces, then unquoted."
5251
:type '(choice string (list string))
5352
:group 'swift-mode:repl
5453
:safe 'stringp)
5554

56-
;;;###autoload
5755
(defcustom swift-mode:swift-package-executable
5856
(concat (when (executable-find "xcrun") "xcrun ") "swift package")
5957
"Path to the Swift command for package manipulation.
@@ -62,7 +60,6 @@ The string is split by spaces, then unquoted."
6260
:group 'swift-mode:repl
6361
:safe 'stringp)
6462

65-
;;;###autoload
6663
(defcustom swift-mode:swift-build-executable
6764
(concat (when (executable-find "xcrun") "xcrun ") "swift build")
6865
"Path to the Swift command for building.
@@ -71,7 +68,6 @@ The string is split by spaces, then unquoted."
7168
:group 'swift-mode:repl
7269
:safe 'stringp)
7370

74-
;;;###autoload
7571
(defcustom swift-mode:debugger-executable
7672
(concat (when (executable-find "xcrun") "xcrun ") "lldb")
7773
"Path to the debugger command.
@@ -80,7 +76,6 @@ The string is split by spaces, then unquoted."
8076
:group 'swift-mode:repl
8177
:safe 'stringp)
8278

83-
;;;###autoload
8479
(defcustom swift-mode:ios-deploy-executable
8580
"ios-deploy"
8681
"Path to ios-deploy command.
@@ -89,7 +84,6 @@ The string is split by spaces, then unquoted."
8984
:group 'swift-mode:repl
9085
:safe 'stringp)
9186

92-
;;;###autoload
9387
(defcustom swift-mode:simulator-controller-executable
9488
(concat (when (executable-find "xcrun") "xcrun ") "simctl")
9589
"Path to the simulator controller command.
@@ -98,7 +92,6 @@ The string is split by spaces, then unquoted."
9892
:group 'swift-mode:repl
9993
:safe 'stringp)
10094

101-
;;;###autoload
10295
(defcustom swift-mode:xcodebuild-executable
10396
(concat (when (executable-find "xcrun") "xcrun ") "xcodebuild")
10497
"Path to the Xcode builder.
@@ -107,7 +100,6 @@ The string is split by spaces, then unquoted."
107100
:group 'swift-mode:repl
108101
:safe 'stringp)
109102

110-
;;;###autoload
111103
(defcustom swift-mode:xcode-select-executable
112104
"xcode-select"
113105
"Path to the Xcode selector.
@@ -116,7 +108,6 @@ The string is split by spaces, then unquoted."
116108
:group 'swift-mode:repl
117109
:safe 'stringp)
118110

119-
;;;###autoload
120111
(defcustom swift-mode:debugger-prompt-regexp "^(lldb) +\\|^[0-9]+> +"
121112
"Regexp to search a debugger prompt."
122113
:type 'string

swift-mode.el

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
:group 'languages
4747
:prefix "swift-mode:")
4848

49+
;;;`update-directory-autoloads' does not handle `:group'.
50+
;;;###autoload (custom-add-load 'languages 'swift-mode)
51+
52+
;; WORKAROUND: `cus-load' overrides `custom-loads'
53+
;;;###autoload (with-eval-after-load 'cus-load
54+
;;;###autoload (custom-add-load 'languages 'swift-mode))
55+
4956
;;; Keymap
5057

5158
(defvar swift-mode-map
@@ -135,6 +142,16 @@ Signal `scan-error' if it hits opening parentheses."
135142
(swift-mode:token:end token))))
136143
token))
137144

145+
(declare-function speedbar-add-supported-extension "speedbar" (extension))
146+
147+
;;;###autoload
148+
(defsubst swift-mode:add-supported-extension-for-speedbar ()
149+
(if (fboundp 'speedbar-add-supported-extension)
150+
(speedbar-add-supported-extension ".swift")
151+
(add-hook 'speedbar-load-hook
152+
(lambda ()
153+
(speedbar-add-supported-extension ".swift")))))
154+
138155
;;;###autoload
139156
(define-derived-mode swift-mode prog-mode "Swift"
140157
"Major mode for editing Swift code.
@@ -190,18 +207,16 @@ Signal `scan-error' if it hits opening parentheses."
190207

191208
(delete-overlay swift-mode:anchor-overlay)
192209

193-
(add-hook 'which-func-functions (lambda ()
194-
(when (equal (with-current-buffer (current-buffer) major-mode) 'swift-mode)
195-
(swift-mode:current-defun-name))))
210+
(add-hook 'which-func-functions
211+
(lambda ()
212+
(when (equal (with-current-buffer (current-buffer) major-mode)
213+
'swift-mode)
214+
(swift-mode:current-defun-name))))
196215
(setq-local add-log-current-defun-function #'swift-mode:current-defun-name))
197216

198217
;;;###autoload (add-to-list 'auto-mode-alist '("\\.swift\\'" . swift-mode))
199218

200-
;;;###autoload (if (fboundp 'speedbar-add-supported-extension)
201-
;;;###autoload (speedbar-add-supported-extension ".swift")
202-
;;;###autoload (add-hook 'speedbar-load-hook
203-
;;;###autoload (lambda ()
204-
;;;###autoload (speedbar-add-supported-extension ".swift"))))
219+
;;;###autoload (swift-mode:add-supported-extension-for-speedbar)
205220

206221
(provide 'swift-mode)
207222

0 commit comments

Comments
 (0)