@@ -187,10 +187,9 @@ CHOICE is a \(key function description allows-capital\)."
187
187
(resize-window--choice-documentation choice))))
188
188
189
189
(defun resize-window--get-documentation-strings ()
190
- (cl-reduce (lambda (c1 c2 )
191
- (concat c1 c2 " \n " ))
192
- (mapcar 'resize-window--display-choice
193
- resize-window-dispatch-alist)))
190
+ (mapconcat #'identity (mapcar 'resize-window--display-choice
191
+ resize-window-dispatch-alist)
192
+ " \n " ))
194
193
195
194
(defun resize-window--make-background ()
196
195
" Place a background over the current window."
@@ -312,5 +311,24 @@ If no SIZE is given, extend by `resize-window-default-argument`"
312
311
(set-window-configuration config)
313
312
(resize-window--create-overlay))))
314
313
314
+ (defvar resize-window--capital-letters (number-sequence ?A ?Z ))
315
+ (defvar resize-window--lower-letters (number-sequence ?a ?z ))
316
+
317
+ (defun resize-window--key-available? (key )
318
+ (let ((keys (mapcar #'resize-window--choice-keybinding resize-window-dispatch-alist)))
319
+ (not (member key keys))))
320
+
321
+ (defun resize-window-add-choice (key func doc &optional allows-capitals )
322
+ " Register a function for resize-window.
323
+ KEY is the char (eg ?c) that should invoke the FUNC. DOC is a doc
324
+ string for the help menu, and optional ALLOWS-CAPITALS should be
325
+ t or nil. Functions should be of zero arity if they do not allow
326
+ capitals, and should be of optional single arity if they allow
327
+ capitals. Invoking with the capital will pass the capital
328
+ argument."
329
+ (if (resize-window--key-available? key)
330
+ (push (list key func doc allows-capitals) resize-window-dispatch-alist)
331
+ (message " The `%s ` key is already taken for resize-window. " (char-to-string key))))
332
+
315
333
(provide 'resize-window )
316
334
; ;; resize-window.el ends here
0 commit comments