forked from emacs-helm/helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm.el
6722 lines (5997 loc) · 284 KB
/
helm.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; helm.el --- Emacs incremental and narrowing framework -*- lexical-binding: t -*-
;; Copyright (C) 2007 Tamas Patrovics
;; 2008 ~ 2011 rubikitch <[email protected]>
;; 2011 ~ 2018 Thierry Volpiatto <[email protected]>
;; This is a fork of anything.el wrote by Tamas Patrovics.
;; Authors of anything.el: Tamas Patrovics
;; rubikitch <[email protected]>
;; Thierry Volpiatto <[email protected]>
;; Author: Thierry Volpiatto <[email protected]>
;; URL: http://github.com/emacs-helm/helm
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(require 'cl-lib)
(require 'async)
(require 'advice) ; Shutup byte compiler about ad-deactivate.
(require 'helm-lib)
(require 'helm-multi-match)
(require 'helm-source)
;;; Multi keys
;;
;;
;;;###autoload
(defun helm-define-multi-key (keymap key functions &optional delay)
"In KEYMAP, define key sequence KEY for function list FUNCTIONS.
Each function runs sequentially for each KEY press.
If DELAY is specified, switch back to initial function of FUNCTIONS list
after DELAY seconds.
The functions in FUNCTIONS list take no args.
e.g
(defun foo ()
(interactive)
(message \"Run foo\"))
(defun bar ()
(interactive)
(message \"Run bar\"))
(defun baz ()
(interactive)
(message \"Run baz\"))
\(helm-define-multi-key global-map (kbd \"<f5> q\") '(foo bar baz) 2)
Each time \"<f5> q\" is pressed, the next function is executed. Waiting
more than 2 seconds between key presses switches back to executing the first
function on the next hit."
(define-key keymap key (helm-make-multi-command functions delay)))
;;;###autoload
(defmacro helm-multi-key-defun (name docstring funs &optional delay)
"Define NAME as a multi-key command running FUNS.
After DELAY seconds, the FUNS list is reinitialized.
See `helm-define-multi-key'."
(declare (indent 2))
(setq docstring (if docstring (concat docstring "\n\n")
"This is a helm-ish multi-key command."))
`(defalias (quote ,name) (helm-make-multi-command ,funs ,delay) ,docstring))
(defun helm-make-multi-command (functions &optional delay)
"Return an anonymous multi-key command running FUNCTIONS.
Run each function in the FUNCTIONS list in turn when called within DELAY seconds."
(declare (indent 1))
(let ((funs functions)
(iter (cl-gensym "helm-iter-key"))
(timeout delay))
(eval (list 'defvar iter nil))
(lambda ()
(interactive)
(helm-run-multi-key-command funs iter timeout))))
(defun helm-run-multi-key-command (functions iterator delay)
(let ((fn (lambda ()
(cl-loop for count from 1 to (length functions)
collect count)))
next)
(unless (and (symbol-value iterator)
;; Reset iterator when another key is pressed.
(eq this-command real-last-command))
(set iterator (helm-iter-list (funcall fn))))
(setq next (helm-iter-next (symbol-value iterator)))
(unless next
(set iterator (helm-iter-list (funcall fn)))
(setq next (helm-iter-next (symbol-value iterator))))
(and next (symbol-value iterator)
(call-interactively (nth (1- next) functions)))
(when delay (run-with-idle-timer
delay nil (lambda ()
(set iterator nil))))))
(helm-multi-key-defun helm-toggle-resplit-and-swap-windows
"Multi key command to re-split and swap helm window.
First call runs `helm-toggle-resplit-window',
and second call within 0.5s runs `helm-swap-windows'."
'(helm-toggle-resplit-window helm-swap-windows) 1)
(put 'helm-toggle-resplit-and-swap-windows 'helm-only t)
;;;###autoload
(defun helm-define-key-with-subkeys (map key subkey command
&optional other-subkeys prompt exit-fn)
"Defines in MAP a KEY and SUBKEY to COMMAND.
This allows typing KEY to call COMMAND the first time and
type only SUBKEY on subsequent calls.
Arg MAP is the keymap to use, SUBKEY is the initial short key-binding to
call COMMAND.
Arg OTHER-SUBKEYS is an alist specifying other short key-bindings
to use once started e.g:
\(helm-define-key-with-subkeys global-map
\(kbd \"C-x v n\") ?n 'git-gutter:next-hunk '((?p . git-gutter:previous-hunk))\)
In this example, `C-x v n' will run `git-gutter:next-hunk'
subsequent \"n\"'s run this command again
and subsequent \"p\"'s run `git-gutter:previous-hunk'.
If specified PROMPT can be displayed in minibuffer to
describe SUBKEY and OTHER-SUBKEYS.
Arg EXIT-FN specifies a function to run on exit.
For any other keys pressed, run their assigned command as defined
in MAP and then exit the loop running EXIT-FN, if specified.
NOTE: SUBKEY and OTHER-SUBKEYS bindings support only char syntax and
vectors, so don't use strings to define them."
(declare (indent 1))
(define-key map key
(lambda ()
(interactive)
(unwind-protect
(progn
(call-interactively command)
(while (let ((input (read-key prompt)) other kb com)
(setq last-command-event input)
(cond
((eq input subkey)
(call-interactively command)
t)
((setq other (assoc input other-subkeys))
(call-interactively (cdr other))
t)
(t
(setq kb (vector last-command-event))
(setq com (lookup-key map kb))
(if (commandp com)
(call-interactively com)
(setq unread-command-events
(nconc (mapcar 'identity kb)
unread-command-events)))
nil)))))
(and exit-fn (funcall exit-fn))))))
;;; Keymap
;;
;;
(defvar helm-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map (kbd "<down>") 'helm-next-line)
(define-key map (kbd "<up>") 'helm-previous-line)
(define-key map (kbd "C-n") 'helm-next-line)
(define-key map (kbd "C-p") 'helm-previous-line)
(define-key map (kbd "<C-down>") 'helm-follow-action-forward)
(define-key map (kbd "<C-up>") 'helm-follow-action-backward)
(define-key map (kbd "<prior>") 'helm-previous-page)
(define-key map (kbd "<next>") 'helm-next-page)
(define-key map (kbd "M-v") 'helm-previous-page)
(define-key map (kbd "C-v") 'helm-next-page)
(define-key map (kbd "M-<") 'helm-beginning-of-buffer)
(define-key map (kbd "M->") 'helm-end-of-buffer)
(define-key map (kbd "C-g") 'helm-keyboard-quit)
(define-key map (kbd "<right>") 'helm-next-source)
(define-key map (kbd "<left>") 'helm-previous-source)
(define-key map (kbd "<RET>") 'helm-maybe-exit-minibuffer)
(define-key map (kbd "C-i") 'helm-select-action)
(define-key map (kbd "C-z") 'helm-execute-persistent-action)
(define-key map (kbd "C-j") 'helm-execute-persistent-action)
(define-key map (kbd "C-o") 'helm-next-source)
(define-key map (kbd "M-o") 'helm-previous-source)
(define-key map (kbd "C-l") 'helm-recenter-top-bottom-other-window)
(define-key map (kbd "M-C-l") 'helm-reposition-window-other-window)
(define-key map (kbd "C-M-v") 'helm-scroll-other-window)
(define-key map (kbd "M-<next>") 'helm-scroll-other-window)
(define-key map (kbd "C-M-y") 'helm-scroll-other-window-down)
(define-key map (kbd "C-M-S-v") 'helm-scroll-other-window-down)
(define-key map (kbd "M-<prior>") 'helm-scroll-other-window-down)
(define-key map (kbd "<C-M-down>") 'helm-scroll-other-window)
(define-key map (kbd "<C-M-up>") 'helm-scroll-other-window-down)
(define-key map (kbd "C-@") 'helm-toggle-visible-mark)
(define-key map (kbd "C-SPC") 'helm-toggle-visible-mark)
(define-key map (kbd "M-SPC") 'helm-toggle-visible-mark)
(define-key map (kbd "M-[") nil)
(define-key map (kbd "M-(") 'helm-prev-visible-mark)
(define-key map (kbd "M-)") 'helm-next-visible-mark)
(define-key map (kbd "C-k") 'helm-delete-minibuffer-contents)
(define-key map (kbd "C-x C-f") 'helm-quit-and-find-file)
(define-key map (kbd "M-m") 'helm-toggle-all-marks)
(define-key map (kbd "M-a") 'helm-mark-all)
(define-key map (kbd "M-U") 'helm-unmark-all)
(define-key map (kbd "C-M-a") 'helm-show-all-in-this-source-only)
(define-key map (kbd "C-M-e") 'helm-display-all-sources)
(define-key map (kbd "C-s") 'undefined)
(define-key map (kbd "M-s") 'undefined)
(define-key map (kbd "C-}") 'helm-narrow-window)
(define-key map (kbd "C-{") 'helm-enlarge-window)
(define-key map (kbd "C-c -") 'helm-swap-windows)
(define-key map (kbd "C-c _") 'helm-toggle-full-frame)
(define-key map (kbd "C-c %") 'helm-exchange-minibuffer-and-header-line)
(define-key map (kbd "C-c C-y") 'helm-yank-selection)
(define-key map (kbd "C-c C-k") 'helm-kill-selection-and-quit)
(define-key map (kbd "C-c C-i") 'helm-copy-to-buffer)
(define-key map (kbd "C-c C-f") 'helm-follow-mode)
(define-key map (kbd "C-c C-u") 'helm-refresh)
(define-key map (kbd "C-c >") 'helm-toggle-truncate-line)
(define-key map (kbd "M-p") 'previous-history-element)
(define-key map (kbd "M-n") 'next-history-element)
(define-key map (kbd "C-!") 'helm-toggle-suspend-update)
(define-key map (kbd "C-x b") 'helm-resume-previous-session-after-quit)
(define-key map (kbd "C-x C-b") 'helm-resume-list-buffers-after-quit)
(helm-define-key-with-subkeys map (kbd "C-c n") ?n 'helm-run-cycle-resume)
;; Disable `file-cache-minibuffer-complete'.
(define-key map (kbd "<C-tab>") 'undefined)
;; Multi keys
(define-key map (kbd "C-t") 'helm-toggle-resplit-and-swap-windows)
;; Debugging command
(define-key map (kbd "C-h C-d") 'undefined)
(define-key map (kbd "C-h C-d") 'helm-enable-or-switch-to-debug)
(define-key map (kbd "C-h c") 'helm-customize-group)
;; Allow to eval keymap without errors.
(define-key map [f1] nil)
(define-key map (kbd "C-h C-h") 'undefined)
(define-key map (kbd "C-h h") 'undefined)
(helm-define-key-with-subkeys map
(kbd "C-w") ?\C-w 'helm-yank-text-at-point
'((?\C-_ . helm-undo-yank-text-at-point)))
;; Use `describe-mode' key in `global-map'.
(cl-dolist (k (where-is-internal 'describe-mode global-map))
(define-key map k 'helm-help))
(define-key map (kbd "C-c ?") 'helm-help)
;; Bind all actions from 1 to 12 to their corresponding nth index+1.
(cl-loop for n from 0 to 12 do
(define-key map (kbd (format "<f%s>" (1+ n)))
`(lambda ()
(interactive)
(helm-select-nth-action ,n))))
map)
"Keymap for helm.")
(defun helm-customize-group ()
"Jump to customization group of current source.
Default to `helm' when group is not defined in source."
(interactive)
(helm-run-after-exit 'customize-group (helm-attr 'group)))
(put 'helm-customize-group 'helm-only t)
(defun helm--action-at-nth-set-fn-1 (value &optional negative)
(cl-loop for n from 1 to 9
for key = (format value n)
for sym = (make-symbol (format "helm-execute-selection-action-at-nth-+%d" n))
for fn = `(lambda ()
(interactive)
(helm-execute-selection-action-at-nth ,(if negative (- n) n)))
do (progn
(defalias sym fn)
(define-key helm-map (kbd key) sym))))
(defun helm--action-at-nth-set-fn- (var val)
(set var val)
(helm--action-at-nth-set-fn-1 val 'negative))
(defun helm--action-at-nth-set-fn+ (var val)
(set var val)
(helm--action-at-nth-set-fn-1 val))
(defcustom helm-action-at-nth-negative-prefix-key "C-x %d"
"The prefix key to execute default action on nth <-n> candidate.
This is a format spec where %d will be replaced by the candidate
number.
NOTE: `setq' have no effect until you restart emacs, use customize for
immediate effect."
:group 'helm
:type 'string
:set #'helm--action-at-nth-set-fn-)
(defcustom helm-action-at-nth-positive-prefix-key "C-c %d"
"The prefix key to execute default action on nth <+n> candidate.
This is a format spec where %d will be replaced by the candidate
number.
NOTE: `setq' have no effect until you restart emacs, use customize for
immediate effect."
:group 'helm
:type 'string
:set #'helm--action-at-nth-set-fn+)
(defgroup helm nil
"Open helm."
:prefix "helm-" :group 'convenience)
(defcustom helm-completion-window-scroll-margin 5
" `scroll-margin' to use for helm completion window.
Set to 0 to disable.
NOTE: This has no effect when `helm-display-source-at-screen-top'
id is non-`nil'."
:group 'helm
:type 'integer)
(defcustom helm-display-source-at-screen-top t
"Display candidates at the top of screen.
This happens with `helm-next-source' and `helm-previous-source'.
NOTE: When non-`nil' (default), disable `helm-completion-window-scroll-margin'."
:group 'helm
:type 'boolean)
(defcustom helm-candidate-number-limit 100
"Global limit for number of candidates displayed.
When the pattern is empty, the number of candidates shown will be
as set here instead of the entire list, which may be hundreds or
thousands. Since narrowing and filtering rapidly reduces
available candidates, having a small list will keep the interface
responsive.
Set this value to nil for no limit."
:group 'helm
:type '(choice (const :tag "Disabled" nil) integer))
(defcustom helm-input-idle-delay 0.01
"Idle time before updating, specified in seconds."
:group 'helm
:type 'float)
(defcustom helm-exit-idle-delay 0
"Idle time before exiting minibuffer while helm is updating.
Has no affect when helm-buffer is up to date \(i.e exit without
delay in this condition\)."
:group 'helm
:type 'float)
(defvaralias 'helm-samewindow 'helm-full-frame)
(make-obsolete-variable 'helm-samewindow 'helm-full-frame "1.4.8.1")
(defcustom helm-full-frame nil
"Use current window for showing candidates.
If t, then Helm does not pop-up new window."
:group 'helm
:type 'boolean)
(defcustom helm-candidate-separator
"--------------------"
"Candidates separator of `multiline' source."
:group 'helm
:type 'string)
(defcustom helm-save-configuration-functions
'(set-window-configuration . current-window-configuration)
"Functions used to restore or save configurations for frames and windows.
Specified as a pair of functions, where car is the restore function and cdr
is the save function.
To save and restore frame configuration, set this variable to
'\(set-frame-configuration . current-frame-configuration\)
NOTE: This may not work properly with own-frame minibuffer
settings. Older versions saves/restores frame configuration, but
the default has changed now to avoid flickering."
:group 'helm
:type 'sexp)
(defcustom helm-display-function 'helm-default-display-buffer
"Function used to display `helm-buffer'.
Local value in `helm-buffer' will take precedence on this default
value. Commands that are in `helm-commands-using-frame' will have
`helm-buffer' displayed in frame, `helm-display-function' being
ignored.
If no local value found and current command is not one of
`helm-commands-using-frame' use this default value.
Function in charge of deciding which value use is
`helm-resolve-display-function'.
To set it locally to `helm-buffer' in helm sources use
`helm-set-local-variable' in init function or use
:display-function slot in `helm' call."
:group 'helm
:type 'symbol)
(defcustom helm-case-fold-search 'smart
"Adds 'smart' option to `case-fold-search'.
Smart option ignores case for searches as long as there are no
upper case characters in the pattern.
Use nil or t to turn off smart behavior and use
`case-fold-search' behavior.
Default is smart.
NOTE: Case fold search has no effect when searching asynchronous
sources, which rely on customized features implemented directly
into their execution process. See helm-grep.el for an example."
:group 'helm
:type '(choice (const :tag "Ignore case" t)
(const :tag "Respect case" nil)
(other :tag "Smart" 'smart)))
(defcustom helm-file-name-case-fold-search
(if (memq system-type
'(cygwin windows-nt ms-dos darwin))
t
helm-case-fold-search)
"Local setting of `helm-case-fold-search' for reading filenames.
See `helm-case-fold-search' for more info."
:group 'helm
:type 'symbol)
(defcustom helm-reuse-last-window-split-state nil
"Use the same state of window split, vertical or horizontal.
`helm-toggle-resplit-window' for the next helm session will use
the same window scheme as the previous session unless
`helm-split-window-default-side' is 'same or 'other."
:group 'helm
:type 'boolean)
(defcustom helm-split-window-preferred-function 'helm-split-window-default-fn
"Default function used for splitting window."
:group 'helm
:type 'function)
(defcustom helm-split-window-default-side 'below
"The default side to display `helm-buffer'.
Must be one acceptable arg for `split-window' SIDE,
that is `below', `above', `left' or `right'.
Other acceptable values are `same' which always display
`helm-buffer' in current window and `other' that display
`helm-buffer' below if only one window or in
`other-window-for-scrolling' when available.
A nil value has same effect as `below'.
If `helm-full-frame' is non-`nil', it take precedence over this setting.
See also `helm-split-window-inside-p' and `helm-always-two-windows' that
take precedence over this.
NOTE: this have no effect if `helm-split-window-preferred-function' is not
`helm-split-window-default-fn' unless this new function can handle this."
:group 'helm
:type 'symbol)
(defcustom helm-display-buffer-default-height nil
"Initial height of `helm-buffer', specified as an integer or a function.
The function should take one arg and the responsibility for
re-sizing the window; function's return value is ignored.
Note that this have no effect when the split is vertical.
See `display-buffer' for more info."
:group 'helm
:type '(choice integer function))
(defcustom helm-display-buffer-default-width nil
"Initial width of `helm-buffer', specified as an integer or a function.
The function should take one arg and the responsibility for
re-sizing the window; function's return value is ignored.
Note that this have no effect when the split is horizontal.
See `display-buffer' for more info."
:group 'helm
:type '(choice integer function))
(defvaralias 'helm-split-window-in-side-p 'helm-split-window-inside-p)
(make-obsolete-variable 'helm-split-window-in-side-p 'helm-split-window-inside-p "2.8.6")
(defcustom helm-split-window-inside-p nil
"Forces split inside selected window when non-`nil'.
See also `helm-split-window-default-side'.
NOTE: this has no effect if
`helm-split-window-preferred-function' is not
`helm-split-window-default-fn' unless this new function can
handle this."
:group 'helm
:type 'boolean)
(defcustom helm-always-two-windows nil
"When non-`nil' helm uses two windows in this frame.
To display `helm-buffer' in one window and `helm-current-buffer'
in the other.
Note: this has no effect when `helm-split-window-inside-p' is non-`nil',
or when `helm-split-window-default-side' is set to 'same.
When `helm-autoresize-mode' is enabled, setting this to nil
will have no effect.
Also when non-`nil' it overrides the effect of `helm-split-window-default-side'
set to `other'."
:group 'helm
:type 'boolean)
(defcustom helm-display-buffer-width 72
"Frame width when displaying helm-buffer in own frame."
:group 'helm
:type 'integer)
(defcustom helm-display-buffer-height 20
"Frame height when displaying helm-buffer in own frame."
:group 'helm
:type 'integer)
(defcustom helm-default-display-buffer-functions nil
"Action functions to pass to `display-buffer'.
See (info \"(elisp) Display Action Functions\").
Have no effect when `helm-always-two-windows' is non-nil and may
override other settings like `helm-split-window-inside-p'."
:group 'helm
:type '(repeat symbol))
(defcustom helm-default-display-buffer-alist nil
"Additional alist to pass to `display-buffer' action.
See (info \"(elisp) Display Action Functions\").
Have no effect when `helm-always-two-windows' is non-nil and may
override other settings like `helm-split-window-inside-p'.
Note that window-height and window-width have to be configured in
`helm-display-buffer-height' and `helm-display-buffer-width'."
:group 'helm
:type '(alist :key-type symbol :value-type sexp))
(defcustom helm-sources-using-default-as-input '(helm-source-imenu
helm-source-imenu-all
helm-source-info-elisp
helm-source-etags-select
helm-source-man-pages
helm-source-occur
helm-source-moccur
helm-source-grep-ag
helm-source-grep-git
helm-source-grep)
"List of helm sources that need to use `helm--maybe-use-default-as-input'.
When a source is a member of this list, default `thing-at-point'
will be used as input."
:group 'helm
:type '(repeat (choice symbol)))
(defcustom helm-delete-minibuffer-contents-from-point t
"When non-`nil', `helm-delete-minibuffer-contents' delete region from `point'.
Otherwise delete `minibuffer-contents'.
See documentation for `helm-delete-minibuffer-contents'."
:group 'helm
:type 'boolean)
(defcustom helm-follow-mode-persistent nil
"When non-`nil', save last state of `helm-follow-mode' for the next emacs sessions.
Each time you turn on or off `helm-follow-mode', the current source name will be stored
or removed from `helm-source-names-using-follow'.
Note that this may be disabled in some places where it is unsafe to use
because persistent action is changing according to context."
:group 'helm
:type 'boolean)
(defcustom helm-source-names-using-follow nil
"A list of source names to have follow enabled.
This list of source names will be used only
when `helm-follow-mode-persistent' is non-nil.
You don't have to customize this yourself unless you really want and
know what you are doing, instead just set
`helm-follow-mode-persistent' to non-nil and as soon you turn on or
off `helm-follow-mode' (C-c C-f) in a source, helm will save or remove
source name in this variable."
:group 'helm
:type '(repeat (choice string)))
(defcustom helm-prevent-escaping-from-minibuffer t
"Prevent escaping from minibuffer with `other-window' during the helm session."
:group 'helm
:type 'boolean)
(defcustom helm-allow-mouse nil
"Allow mouse usage during the helm session when non-nil.
Note that this also allow moving out of minibuffer when clicking
outside of `helm-buffer', up to you to get back to helm by clicking
back in `helm-buffer' of minibuffer."
:group 'helm
:type 'boolean)
(defcustom helm-move-to-line-cycle-in-source nil
"Cycle to the beginning or end of the list after reaching the bottom or top.
This applies when using `helm-next/previous-line'."
:group 'helm
:type 'boolean)
(defcustom helm-fuzzy-match-fn 'helm-fuzzy-match
"The function for fuzzy matching in `helm-source-sync' based sources."
:group 'helm
:type 'function)
(defcustom helm-fuzzy-search-fn 'helm-fuzzy-search
"The function for fuzzy matching in `helm-source-in-buffer' based sources."
:group 'helm
:type 'function)
(defcustom helm-fuzzy-sort-fn 'helm-fuzzy-matching-default-sort-fn
"The sort transformer function used in fuzzy matching.
When nil, sorting is not done."
:group 'helm
:type 'function)
(defcustom helm-fuzzy-matching-highlight-fn 'helm-fuzzy-default-highlight-match
"The function to highlight fuzzy matches.
When nil, no highlighting is done."
:group 'helm
:type 'function)
(defcustom helm-autoresize-max-height 40
"Specifies maximum height and defaults to percent of helm window's frame height.
See `fit-window-to-buffer' for more infos."
:group 'helm
:type 'integer)
(defcustom helm-autoresize-min-height 10
"Specifies minimum height and defaults to percent of helm window's frame height.
If nil, `window-min-height' is used.
See `fit-window-to-buffer' for details."
:group 'helm
:type 'integer)
(defcustom helm-input-method-verbose-flag nil
"The default value for `input-method-verbose-flag' used in helm minibuffer.
It is nil by default, which does not turn off input method. Helm
updates and exits without interruption -- necessary for complex methods.
If set to any other value as per `input-method-verbose-flag',
then use `C-\\' to disable the `current-input-method' to exit or update helm"
:group 'helm
:type '(radio :tag "A flag to control extra guidance for input methods in helm."
(const :tag "Never provide guidance" nil)
(const :tag "Always provide guidance" t)
(const :tag "Provide guidance only for complex methods" complex-only)))
(defcustom helm-display-header-line t
"Display header-line when non nil."
:group 'helm
:type 'boolean)
(defcustom helm-inherit-input-method t
"Inherit `current-input-method' from `current-buffer' when non-`nil'.
The default is to enable this by default and then toggle
`toggle-input-method'."
:group 'helm
:type 'boolean)
(defcustom helm-echo-input-in-header-line nil
"Send current input in header-line when non-nil."
:group 'helm
:type 'boolean)
(defcustom helm-header-line-space-before-prompt 'left-fringe
"Specify the space before prompt in header-line.
This will be used when `helm-echo-input-in-header-line' is non-nil.
Value can be one of the symbols 'left-fringe or 'left-margin or an
integer specifying the number of spaces before prompt.
Note that on input longer that `window-width' the continuation string
will be shown on left side of window without taking care of this."
:group 'helm
:type '(choice
(symbol
(const :tag "Fringe" 'left-fringe)
(const :tag "Margin" 'left-margin))
integer))
(defcustom helm-tramp-connection-min-time-diff 5
"Value of `tramp-connection-min-time-diff' for helm remote processes.
If set to zero helm remote processes are not delayed.
Setting this to a value less than 5 or disabling it with a zero value
is risky, however on emacs versions starting at 24.5 it seems
it is now possible to disable it.
Anyway at any time in helm you can suspend your processes while typing
by hitting \\<helm-map> `\\[helm-toggle-suspend-update]'.
Only async sources than use a sentinel calling
`helm-process-deferred-sentinel-hook' are affected by this."
:type 'integer
:group 'helm)
(defcustom helm-debug-root-directory nil
"When non-`nil', saves helm log messages to a file in this directory.
When `nil' log messages are saved to a buffer instead.
Log message are saved only when `helm-debug' is non-nil, so setting this
doesn't enable debugging by itself.
See `helm-log-save-maybe' for more info."
:type 'string
:group 'helm)
(defcustom helm-show-action-window-other-window nil
"Show action buffer beside `helm-buffer' when non-nil.
If nil don't split and replace helm-buffer by the action buffer
in same window.
If left display the action buffer at the left of helm-buffer.
If right or any other value, split at right.
Note that this may not fit well with some helm window configurations,
so it have only effect when `helm-always-two-windows' is non-nil."
:group 'helm
:type '(choice
(const :tag "Split at left" left)
(const :tag "Don't split" nil)
(other :tag "Split at right" right)))
(defcustom helm-cycle-resume-delay 1.0
"Delay used before resuming in `helm-run-cycle-resume'."
:type 'float
:group 'helm)
(defcustom helm-display-buffer-reuse-frame nil
"When non nil helm frame is not deleted and reused in next sessions.
This was used to workaround a bug in emacs where frames where
popping up slowly, now that the bug have been fixed upstream probably
you don't want to use this anymore."
:group 'helm
:type 'boolean)
(defcustom helm-commands-using-frame nil
"A list of commands where `helm-buffer' is displayed in a frame."
:group 'helm
:type '(repeat symbol))
(defcustom helm-actions-inherit-frame-settings t
"Actions inherit helm frame settings of initial command when non nil."
:group 'helm
:type 'boolean)
(defcustom helm-use-undecorated-frame-option nil
"Display helm frame undecorated when non nil.
This option have no effect with emacs versions lower than 26."
:group 'helm
:type 'boolean)
(defcustom helm-use-frame-when-more-than-two-windows nil
"Display helm buffer in frame when more than two windows."
:group 'helm
:type 'boolean)
(defcustom helm-default-prompt-display-function
#'helm-set-default-prompt-display
"The function to use to set face of fake cursor in header-line."
:group 'helm
:type 'function)
;;; Faces
;;
;;
(defgroup helm-faces nil
"Customize the appearance of helm."
:prefix "helm-"
:group 'faces
:group 'helm)
(defface helm-source-header
'((((background dark))
:background "#22083397778B"
:foreground "white"
:weight bold :height 1.3 :family "Sans Serif")
(((background light))
:background "#abd7f0"
:foreground "black"
:weight bold :height 1.3 :family "Sans Serif"))
"Face for source header in the helm buffer."
:group 'helm-faces)
(defface helm-visible-mark
'((((min-colors 88) (background dark))
(:background "green1" :foreground "black"))
(((background dark))
(:background "green" :foreground "black"))
(((background light)) :background "#d1f5ea")
(((min-colors 88))
(:background "green1"))
(t (:background "green")))
"Face for visible mark."
:group 'helm-faces)
(defface helm-header
'((t (:inherit header-line)))
"Face for header lines in the helm buffer."
:group 'helm-faces)
(defface helm-candidate-number
'((((background dark)) :background "Yellow" :foreground "black")
(((background light)) :background "#faffb5" :foreground "black"))
"Face for candidate number in mode-line."
:group 'helm-faces)
(defface helm-candidate-number-suspended
'((t (:inherit helm-candidate-number :inverse-video t)))
"Face for candidate number in mode-line when helm is suspended."
:group 'helm-faces)
(defface helm-selection
'((((background dark)) :background "ForestGreen"
:distant-foreground "black")
(((background light)) :background "#b5ffd1"
:distant-foreground "black"))
"Face for currently selected item in the helm buffer."
:group 'helm-faces)
(defface helm-separator
'((((background dark)) :foreground "red")
(((background light)) :foreground "#ffbfb5"))
"Face for multiline source separator."
:group 'helm-faces)
(defface helm-action
'((t (:underline t)))
"Face for action lines in the helm action buffer."
:group 'helm-faces)
(defface helm-prefarg
'((((background dark)) :foreground "green")
(((background light)) :foreground "red"))
"Face for showing prefix arg in mode-line."
:group 'helm-faces)
(defface helm-match
'((((background light)) :foreground "#b00000")
(((background dark)) :foreground "gold1"))
"Face used to highlight matches."
:group 'helm-faces)
(defface helm-header-line-left-margin
'((t (:foreground "black" :background "yellow")))
"Face used to highlight helm-header sign in left-margin."
:group 'helm-faces)
;;; Variables.
;;
;;
(defvar helm-selection-overlay nil
"Overlay used to highlight the currently selected item.")
(defvar helm-async-processes nil
"List of information about asynchronous processes managed by helm.")
(defvar helm-before-initialize-hook nil
"Runs before helm initialization.
This hook runs before init functions in `helm-sources', which is
before creation of `helm-buffer'. Set local variables for
`helm-buffer' that need a value from `current-buffer' with
`helm-set-local-variable'.")
(defvar helm-after-initialize-hook nil
"Runs after helm initialization.
This hook runs after `helm-buffer' is created but not from
`helm-buffer'. The hook needs to specify in which buffer to run.")
(defvaralias 'helm-update-hook 'helm-after-update-hook)
(make-obsolete-variable 'helm-update-hook 'helm-after-update-hook "1.9.9")
(defvar helm-after-update-hook nil
"Runs after updating the helm buffer with the new input pattern.")
(defvar helm-cleanup-hook nil
"Runs after exiting the minibuffer and before performing an
action.
This hook runs even if helm exits the minibuffer abnormally (e.g.
via `helm-keyboard-quit').")
(defvar helm-select-action-hook nil
"Runs when opening the action buffer.")
(defvar helm-before-action-hook nil
"Runs before executing action.
Unlike `helm-cleanup-hook', this hook runs before helm closes the
minibuffer and also before performing an action.")
(defvar helm-after-action-hook nil
"Runs after executing action.")
(defvar helm-exit-minibuffer-hook nil
"Runs just before exiting the minibuffer.
This hook runs when helm exits the minibuffer normally (e.g. via
candidate selection), but does NOT run if helm exits the
minibuffer abnormally (e.g. via `helm-keyboard-quit').")
(defvar helm-after-persistent-action-hook nil
"Runs after executing persistent action.")
(defvar helm-move-selection-before-hook nil
"Runs before moving selection in `helm-buffer'.")
(defvar helm-move-selection-after-hook nil
"Runs after moving selection in `helm-buffer'.")
(defvar helm-after-preselection-hook nil
"Runs after pre-selection in `helm-buffer'.")
(defvar helm-window-configuration-hook nil
"Runs when switching to and from the action buffer.")
(defvar helm-execute-action-at-once-if-one nil
"When non--nil executes the default action and then exits if only one candidate.
If symbol 'current-source is given as value exit if only one candidate
in current source.
This variable accepts a function with no args that should returns a boolean
value or 'current-source.")
(defvar helm-quit-if-no-candidate nil
"When non-`nil', quits if there are no candidates.
This variable accepts a function.")
(defvar helm-debug-variables nil
"A list of helm variables that `helm-debug-output' displays.
If `nil', `helm-debug-output' includes only variables with
`helm-' prefixes.")
(defvar helm-debug-buffer "*Debug Helm Log*")
(defvar helm-debug nil
"If non-`nil', write log message to `helm-debug-buffer'.
Default is `nil', which disables writing log messages because the
size of `helm-debug-buffer' grows quickly.")
(defvar helm-mode-line-string "\
\\<helm-map>\
\\[helm-help]:Help \
\\[helm-select-action]:Act \
\\[helm-maybe-exit-minibuffer]/\
f1/f2/f-n:NthAct \
\\[helm-toggle-suspend-update]:Tog.suspend"
"Help string displayed by helm in the mode-line.
It is either a string or a list of two string arguments where the
first string is the name and the second string is displayed in
the mode-line. When `nil', uses default `mode-line-format'.")
(defvar helm-minibuffer-set-up-hook nil
"Hook that runs at minibuffer initialization.
A hook useful for modifying minibuffer settings in helm.
An example that hides the minibuffer when using
`helm-echo-input-in-header-line':
(add-hook 'helm-minibuffer-set-up-hook #'helm-hide-minibuffer-maybe)
Note that we check `helm-echo-input-in-header-line' value
from `helm-buffer' which allow detecting possible local
value of this var.")
(defvar helm-help-message
"* Helm Generic Help
** Basics
Helm narrows down the list of candidates as you type a filter pattern.
Helm accepts multiple space-separated patterns, each pattern can be negated with \"!\".
Helm also supports fuzzy matching in some places when specified, you will find
several variables to enable fuzzy matching in diverse sources,
see [[https://github.com/emacs-helm/helm/wiki/Fuzzy-matching][fuzzy-matching]] in helm-wiki for more infos.
Helm generally uses familiar Emacs keys to navigate the list.
Here follow some of the less obvious bindings:
- `\\[helm-maybe-exit-minibuffer]' selects the candidate from the list, executes the default action