-
-
Notifications
You must be signed in to change notification settings - Fork 101
/
highlight.el
3452 lines (3199 loc) · 171 KB
/
highlight.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
;;; highlight.el --- Highlighting commands.
;;
;; Filename: highlight.el
;; Description: Highlighting commands.
;; Author: Drew Adams
;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
;; Copyright (C) 1995-2022, Drew Adams, all rights reserved.
;; Created: Wed Oct 11 15:07:46 1995
;; Version: 0
;; Package-Requires: ()
;; Last-Updated: Sun Mar 20 13:38:50 2022 (-0700)
;; By: dradams
;; Update #: 4247
;; URL: https://www.emacswiki.org/emacs/download/highlight.el
;; URL (GIT mirror): https://framagit.org/steckerhalter/highlight.el
;; Doc URL: https://www.emacswiki.org/emacs/HighlightLibrary
;; Keywords: faces, help, local
;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x, 24.x, 25.x, 26.x
;;
;; Features that might be required by this library:
;;
;; `apropos', `apropos+', `auth-source', `avoid', `backquote',
;; `bookmark', `bookmark+', `bookmark+-1', `bookmark+-bmu',
;; `bookmark+-key', `bookmark+-lit', `button', `bytecomp', `cconv',
;; `cl', `cl-generic', `cl-lib', `cl-macs', `cmds-menu',
;; `col-highlight', `crosshairs', `custom', `doremi', `doremi-frm',
;; `easymenu', `eieio', `eieio-core', `eieio-loaddefs',
;; `epg-config', `facemenu', `facemenu+', `faces', `faces+',
;; `fit-frame', `font-lock', `font-lock+', `font-lock-menus',
;; `frame-cmds', `frame-fns', `gv', `help+', `help-fns',
;; `help-fns+', `help-macro', `help-macro+', `help-mode', `hexrgb',
;; `hl-line', `hl-line+', `info', `info+', `kmacro', `macroexp',
;; `menu-bar', `menu-bar+', `misc-cmds', `misc-fns', `mwheel',
;; `naked', `package', `palette', `password-cache', `pp', `pp+',
;; `radix-tree', `rect', `replace', `ring', `second-sel', `seq',
;; `strings', `syntax', `tabulated-list', `text-mode', `thingatpt',
;; `thingatpt+', `timer', `url-handlers', `url-parse', `url-vars',
;; `vline', `w32browser-dlgopen', `wid-edit', `wid-edit+',
;; `widget', `zones'.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Highlighting commands.
;;
;; More description below.
;;(@> "Index")
;;
;; Index
;; -----
;;
;; If you have library `linkd.el' and Emacs 22 or later, load
;; `linkd.el' and turn on `linkd-mode' now. It lets you easily
;; navigate around the sections of this doc. Linkd mode will
;; highlight this Index, as well as the cross-references and section
;; headings throughout this file. You can get `linkd.el' here:
;; https://www.emacswiki.org/emacs/download/linkd.el.
;;
;; (@> "Things Defined Here")
;; (@> "Documentation")
;; (@> "Libraries `facemenu+.el' and `mouse3.el' put Highlight on the Menu")
;; (@> "User Options `hlt-use-overlays-flag' and `hlt-overlays-priority'")
;; (@> "Temporary or Permanent Highlighting")
;; (@> "Commands")
;; (@> "Copy and Yank (Paste) Text Properties")
;; (@> "User Option `hlt-act-on-any-face-flag'")
;; (@> "Hiding and Showing Text")
;; (@> "Hiding and Showing Text - Icicles Multi-Commands")
;; (@> "What Gets Highlighted: Region, Buffer, New Text You Type")
;; (@> "Interaction with Font Lock")
;; (@> "Suggested Bindings")
;; (@> "See Also")
;; (@> "Commands That Won't Work in Emacs 20")
;; (@> "To Do")
;; (@> "Change log")
;; (@> "Macros")
;; (@> "Key Bindings")
;; (@> "Menus")
;; (@> "Variables and Faces")
;; (@> "Misc Functions - Emacs 20+")
;; (@> "Misc Functions - Emacs 21+")
;; (@> "Functions for Highlighting Propertized Text - Emacs 21+")
;; (@> "Functions for Highlighting Isearch Matches - Emacs 23+")
;; (@> "General and Utility Functions")
;;(@* "Things Defined Here")
;;
;; Things Defined Here
;; -------------------
;;
;; Macros defined here:
;;
;; `hlt-user-error'.
;;
;; Commands defined here:
;;
;; `hlt-choose-default-face', `hlt-copy-props', `hlt-eraser',
;; `hlt-eraser-mouse', `hlt-hide-default-face', `hlt-highlight',
;; `hlt-highlight-all-prop', `hlt-highlight-enclosing-list',
;; `hlt-highlighter', `hlt-highlighter-mouse',
;; `hlt-highlight-isearch-matches',
;; `hlt-highlight-line-dups-region', `hlt-highlight-lines',
;; `hlt-highlight-property-with-value',
;; `hlt-highlight-regexp-groups-region',
;; `hlt-highlight-regexp-region',
;; `hlt-highlight-regexp-region-in-buffers',
;; `hlt-highlight-regexp-to-end', `hlt-highlight-region',
;; `hlt-highlight-region-in-buffers', `hlt-highlight-regions',
;; `hlt-highlight-regions-in-buffers',
;; `hlt-highlight-single-quotations', `hlt-highlight-symbol',
;; `hlt-mouse-copy-props', `hlt-mouse-face-each-line',
;; `hlt-next-face', `hlt-next-highlight', `hlt-paste-props',
;; `hlt-previous-face', `hlt-previous-highlight',
;; `hlt-replace-highlight-face',
;; `hlt-replace-highlight-face-in-buffers',
;; `hlt-show-default-face', `hlt-toggle-act-on-any-face-flag',
;; `hlt-toggle-link-highlighting',
;; `hlt-toggle-property-highlighting',
;; `hlt-toggle-use-overlays-flag', `hlt-unhighlight-all-prop',
;; `hlt-unhighlight-isearch-matches',
;; `hlt-unhighlight-regexp-groups-region',
;; `hlt-unhighlight-regexp-region',
;; `hlt-unhighlight-regexp-region-in-buffers',
;; `hlt-unhighlight-regexp-to-end', `hlt-unhighlight-region',
;; `hlt-unhighlight-region-for-face',
;; `hlt-unhighlight-region-for-face-in-buffers',
;; `hlt-unhighlight-region-in-buffers', `hlt-unhighlight-regions',
;; `hlt-unhighlight-regions-in-buffers',`hlt-unhighlight-symbol',
;; `hlt-yank-props'.
;;
;; User options (variables) defined here:
;;
;; `hlt-act-on-any-face-flag', `hlt-auto-face-backgrounds',
;; `hlt-auto-face-foreground', `hlt-auto-faces-flag',
;; `hlt-default-copy/yank-props', `hlt-face-prop',
;; `hlt-line-dups-ignore-regexp', `hlt-max-region-no-warning',
;; `hlt-overlays-priority', `hlt-use-overlays-flag'.
;;
;; Faces defined here:
;;
;; `hlt-property-highlight', `hlt-regexp-level-1',
;; `hlt-regexp-level-2', `hlt-regexp-level-3',
;; `hlt-regexp-level-4', `hlt-regexp-level-5',
;; `hlt-regexp-level-6', `hlt-regexp-level-7',
;; `hlt-regexp-level-8', `minibuffer-prompt' (for Emacs 20).
;;
;; Non-interactive functions defined here:
;;
;; `hlt-+/--highlight-regexp-read-args',
;; `hlt-+/--highlight-regexp-region', `hlt-+/--read-regexp',
;; `hlt-+/--read-bufs', `hlt-add-listifying',
;; `hlt-add-to-invisibility-spec', `hlt-delete-highlight-overlay',
;; `hlt-highlight-faces-in-buffer', `hlt-flat-list',
;; `hlt-highlight-faces-in-buffer', `hlt-highlight-regexp-groups',
;; `hlt-listify-invisibility-spec',
;; `hlt-mouse-toggle-link-highlighting',
;; `hlt-mouse-toggle-property-highlighting',
;; `hlt-nonempty-region-p', `hlt-props-to-copy/yank',
;; `hlt-read-bg/face-name', `hlt-read-props-completing',
;; `hlt-region-or-buffer-limits', `hlt-remove-if-not',
;; `hlt-set-intersection', `hlt-set-union', `hlt-string-match-p',
;; `hlt-subplist', `hlt-tty-colors', `hlt-unhighlight-for-overlay'.
;;
;; Internal variables defined here:
;;
;; `hlt-copied-props', `hlt-face-nb', `hlt-last-face',
;; `hlt-last-regexp', `hlt-map',
;; `hlt-previous-use-overlays-flag-value',
;; `hlt-prop-highlighting-state'.
;;(@* "Documentation")
;;
;; Documentation
;; -------------
;;
;;(@* "Libraries `facemenu+.el' and `mouse3.el' put Highlight on the Menu")
;; ** Libraries `facemenu+.el' and `mouse3.el' put Highlight on the Menu **
;;
;; If you load library `facemenu+.el' after you load library
;; `highlight.el' then commands defined here are also available on a
;; `Highlight' submenu in the Text Properties menus.
;;
;; If you load library `mouse3.el' after you load library
;; `highlight.el' then:
;;
;; * Commands defined here are also available on a `Highlight'
;; submenu of the `Region' right-click popup menu.
;;
;; * Commands `hlt-highlight-symbol' and `hlt-unhighlight-symbol'
;; are available on the `Thing at Pointer' submenu of the `No
;; Region' right-click popup menu.
;;
;;(@* "User Options `hlt-use-overlays-flag' and `hlt-overlays-priority'")
;; ** User Options `hlt-use-overlays-flag' and `hlt-overlays-priority'
;;
;; You can highlight text in two ways using this library, depending
;; on the value of user option `hlt-use-overlays-flag':
;;
;; - non-nil means to highlight using overlays
;; - nil means to highlight using text properties
;;
;; Overlays are independent from the text itself. They are not
;; picked up when you copy and paste text. By default, highlighting
;; uses overlays.
;;
;; Although highlighting recognizes only nil and non-nil values for
;; `hlt-use-overlays-flag', other actions can have different
;; behavior, depending on the non-nil value. If it is `only' (the
;; default value), then only overlay highlighting is affected. If it
;; is any other non-nil value, then both overlay highlighting and
;; text-property highlighting are effected. This is the case, for
;; instance, for unhighlighting and for navigating among highlights.
;;
;; For example, for unhighlighting, if `hlt-use-overlays-flag' is
;; non-nil, then overlay highlighting is removed. If it is not
;; `only', then text-property highlighting is removed. A value of
;; nil thus removes both overlays and text properties.
;;
;; Keep this sensitivity to the value of `hlt-use-overlays-flag' in
;; mind. For example, if you change the value after adding some
;; highlighting, then that highlighting might not be removed by
;; unhighlighting, unless you change the value back again.
;;
;; You can toggle the value of `hlt-use-overlays-flag' at any time
;; between nil and its previous non-nil value, using command
;; `hlt-toggle-use-overlays-flag'.
;;
;; Option `hlt-overlays-priority' is the priority assigned to
;; overlays created by `hlt-* functions. A higher priority makes an
;; overlay seem to be "on top of" lower priority overlays. The
;; default value is a zero priority.
;;
;;(@* "Temporary or Permanent Highlighting")
;; ** "Temporary or Permanent Highlighting" **
;;
;; Generally, highlighting you add is temporary: it is not saved when
;; you write your buffer to disk. However, Emacs has a curious and
;; unfamiliar feature called "formatted" or "enriched" text mode,
;; which does record highlighting permanently. See the Emacs manual,
;; node `Requesting Formatted Text'.
;;
;; To save highlighting permanently, do the following:
;;
;; 1. `M-x enriched-mode', to put your file buffer in minor mode
;; `enriched-mode'. You see `Enriched' in the mode line.
;;
;; 2. Choose text-property highlighting, not overlay highlighting, by
;; setting option `hlt-use-overlays-flag' to `nil'. To do this
;; using Customize, choose menu item `Highlight using text
;; properties, not overlays'.
;;
;; 3. Choose the highlight face to use:
;; `M-x hlt-choose-default-face'.
;;
;; 4. Highlight in any way provided by library `highlight.el'. For
;; example, use `hlt-highlighter' (personally, I bind it to `C-x
;; mouse-2') to drag-highlight as if using a marker pen.
;;
;; 5. Save your file.
;;
;; Note that, although highlighting in enriched-text mode modifies
;; the buffer, it does not appear modified (check the beginning of
;; the mode line), so if you make no other changes then using `C-x
;; C-s' does not save your highlighting changes. To remedy this,
;; just do something besides highlighting - e.g., add a space and
;; delete it - so that `C-x C-s' saves to disk.
;;
;; When you reopen your file later, it is automatically in enriched
;; mode, and your highlighting shows. However, be aware that
;; font-locking can interfere with enriched mode, so you might want
;; to use it on files where you don't use font-locking. But see also
;; (@> "Interaction with Font Lock").
;;
;;(@* "Commands")
;; ** Commands **
;;
;; You can use any face to highlight, and you can apply a mouse face
;; instead of a face, if you like. A mouse face shows up only when
;; the mouse pointer is over it.
;;
;; The main command to choose a face to use for highlighting (or for
;; unhighlighting) is `hlt-choose-default-face'. It reads a face
;; name, with completion.
;;
;; But you can alternatively choose a color name instead of a face
;; name. The completion candidates are annotated in buffer
;; `*Completions*' with `Face' or `Color', to help you identify them.
;;
;; If you use library Icicles and option
;; `icicle-WYSIWYG-Completions-flag' is non-nil, then candidate faces
;; and colors are WYSIWYG: What You See Is What You Get.
;;
;; If you choose a color instead of a face then an unnamed pseudo
;; face is created and used. It has the chosen color as background,
;; and its foreground color is determined by the value of user option
;; `hlt-auto-face-foreground'. If that option is nil then
;; highlighting does not change the existing foreground color.
;; Otherwise, the option value is the foreground color used for
;; highlighting.
;;
;; Another way to choose the highlighting face is to use command
;; `hlt-next-face' or `hlt-previous-face'. These cycle among a
;; smaller set of faces and background colors, the elements in the
;; list value of option `hlt-auto-face-backgrounds'. You can use a
;; numeric prefix argument with these commands to choose any of the
;; elements by its absolute position in the list.
;;
;; Choosing the default highlighting face using
;; `hlt-choose-default-face', `hlt-next-face', or `hlt-previous-face'
;; affects the next highlighting or unhighlighting operation. You
;; can also choose to automatically cycle among the faces defined by
;; `hlt-auto-face-backgrounds', with each (un)highlighting command
;; using the next face in the list. To choose this behavior,
;; customize option `hlt-auto-faces-flag' to non-nil.
;;
;; The commands with `region' in their name act on the text in the
;; active region. If the region is not active then they act on the
;; text in the whole buffer. The commands with `to-end' in their
;; name act on the text from point to the end of the buffer. See
;; also (@> "What Gets Highlighted: Region, Buffer, New Text You Type").
;;
;; The commands you will use the most often are perhaps
;; `hlt-highlight', `hlt-highlighter', `hlt-highlight-symbol',
;; `hlt-next-highlight', and `hlt-previous-highlight', as well as
;; unhighlighting commands. You might also often use the various
;; commands to hide and show highlighted text.
;;
;; You can use command `hlt-highlight' to highlight or unhighlight
;; the region, or to highlight or unhighlight a regexp throughout the
;; region, depending on the prefix argument. It combines the
;; behaviors of commands `hlt-highlight-region',
;; `hlt-unhighlight-region', `hlt-highlight-regexp-region', and
;; `hlt-highlight-regexp-region'. I suggest that you bind
;; `hlt-highlight' to a key - I use `C-x C-y'.
;;
;; Commands `hlt-highlight-regexp-to-end' and
;; `hlt-unhighlight-regexp-to-end' highlight and unhighlight a regexp
;; from point to the end of the buffer, respectively.
;;
;; Command `hlt-highlighter' lets you highlight text by simply
;; dragging the mouse, just as you would use a highlighter (marker).
;; You can thus highlight text the same way that you drag the mouse
;; to define the region.
;;
;; Command `hlt-eraser' lets you delete highlighting by dragging the
;; mouse. However, its behavior is different for overlays and text
;; properties, and it is perhaps different from you expect. If
;; option `hlt-use-overlays-flag' is not `only' then it removes
;; text-property highlighting for *ALL* faces (not just highlighting
;; faces).
;;
;; A prefix arg for `hlt-highlighter' and `hlt-eraser' acts the same
;; as for `hlt-next-face': it lets you choose the face to use. It
;; has no effect for `hlt-eraser' unless `hlt-use-overlays-flag' is
;; `only', in which case it erases the Nth face in
;; `hlt-auto-face-backgrounds', where N is the prefix arg.
;;
;; Command `hlt-highlight-regexp-groups-region', like command
;; `hlt-highlight-regexp-region', highlights regexp matches. But
;; unlike the latter, it highlights the regexp groups (up to 8
;; levels) using different faces - faces `hlt-regexp-level-1' through
;; `hlt-regexp-level-8'. Use it, for example, when you are trying
;; out a complex regexp, to see what it is actually matching.
;; Command `hlt-unhighlight-regexp-groups-region' unhighlights such
;; highlighting.
;;
;; Command `hlt-highlight-line-dups-region' highlights the sets of
;; duplicate lines in the region (or the buffer, if the region is not
;; active). By default, leading and trailing whitespace are ignored
;; when checking for duplicates, but this is controlled by option
;; `hlt-line-dups-ignore-regexp'. And with a prefix arg the behavior
;; effectively acts opposite to the value of that option. So if the
;; option says not to ignore whitespace and you use a prefix arg then
;; whitespace is ignored, and vice versa.
;;
;; If you use Emacs 21 or later, you can use various commands that
;; highlight and unhighlight text that has certain text properties
;; with given values. You can use them to highlight all text in the
;; region or buffer that has a given property value. An example is
;; highlighting all links (text with property `mouse-face'). These
;; commands are:
;;
;; `hlt-highlight-all-prop' - Highlight text that has a given
;; property with any (non-nil) value.
;;
;; `hlt-highlight-property-with-value' - Highlight text that has a
;; given property with certain values.
;;
;; `hlt-unhighlight-all-prop' - Unhighlight highlighted propertized
;; text.
;;
;; `hlt-mouse-toggle-link-highlighting' - Alternately highlight and
;; unhighlight links on a mouse click.
;;
;; `hlt-toggle-link-highlighting' - Alternately highlight and
;; unhighlight links.
;;
;; `hlt-mouse-toggle-property-highlighting' - Alternately highlight
;; and unhighlight propertized text on a
;; mouse click.
;;
;; `hlt-toggle-property-highlighting' - Alternately highlight and
;; unhighlight propertized text.
;;
;; As always for library `highlight.el', this "highlighting" can use
;; property `mouse-face' instead of `face'. You could, for example,
;; highlight, using `mouse-face', all text that has property `foo' -
;; or that has property `face', for that matter.
;;
;; If you use Emacs 21 or later, you can use commands
;; `hlt-next-highlight' and `hlt-previous-highlight' to navigate
;; among highlights of a given face.
;;
;; You can unhighlight the region/buffer or a regexp in the
;; region/buffer using command `hlt-unhighlight-region' or
;; `hlt-unhighlight-regexp-region'. If you use overlay highlighting
;; then you can use command `hlt-unhighlight-region-for-face' to
;; unhighlight the region/buffer for an individual highlighting face
;; - other highlighting faces remain.
;;
;; You can replace a highlighting face in the region/buffer by
;; another, using command `hlt-replace-highlight-face'. With a
;; prefix argument, property `mouse-face' is used, not property
;; `face'.
;;
;; Command `hlt-highlight-single-quotations' highlights single-quoted
;; text in the region. For example, Emacs commands and keys between
;; ` and ': `foobar'.
;;
;; Command `hlt-mouse-face-each-line' puts a `mouse-face' property on
;; each line of the region.
;;
;; Command `hlt-highlight-lines' highlights all lines touched by the
;; region, extending the highlighting to the window edges.
;;
;; You can highlight and unhighlight multiple buffers at the same
;; time. Just as for a single buffer, there are commands for regexp
;; (un)highlighting, and all of the multiple-buffer commands, whose
;; names end in `-in-buffers', are sensitive to the region in each
;; buffer, when active. These are the multiple-buffer commands:
;;
;; `hlt-highlight-region-in-buffers'
;; `hlt-unhighlight-region-in-buffers'
;; `hlt-highlight-regexp-region-in-buffers'
;; `hlt-unhighlight-regexp-region-in-buffers'
;; `hlt-unhighlight-region-for-face-in-buffers'
;; `hlt-replace-highlight-face-in-buffers'
;;
;; Normally, you are prompted for the names of the buffers, one at a
;; time. Use `C-g' when you are done entering buffer names. But a
;; non-positive prefix arg means act on all visible or iconified
;; buffers. (A non-negative prefix arg means use property
;; `mouse-face', not `face'.)
;;
;; If you also use library `zones.el' then narrowing and other
;; operations record buffer zones (including narrowings) in (by
;; default) buffer-local variable `zz-izones'. Besides narrowing,
;; you can use `C-x n a' (command `zz-add-zone') to add the current
;; region to the same variable.
;;
;; You can use command `hlt-highlight-regions' to highlight buffer
;; zones, as defined by their limits (interactively, `zz-izones'),
;; and you can use command `hlt-highlight-regions-in-buffers' to
;; highlight all zones recorded for a given set of buffers. You can
;; use commands `hlt-unhighlight-regions' and
;; `hlt-unhighlight-regions-in-buffers' to unhighlight them. If
;; option `hlt-auto-faces-flag' is non-nil then each zone gets a
;; different face. Otherwise, all of them are highlighted with the
;; same face.
;;
;; From Isearch you can highlight the search-pattern matches. You
;; can do this across multiple buffers being searched together.
;; These keys are bound on the Isearch keymap for this:
;;
;; `M-s h h' - `hlt-highlight-isearch-matches'
;; `M-s h u' - `hlt-unhighlight-isearch-matches'
;;
;; Unlike standard Isearch key `M-s h r' (`isearch-highlight-regexp')
;; `M-s h h' and `M-s h u' use only highlighting created by library
;; `highlight', and they do not exit Isearch.
;;
;;(@* "Copy and Yank (Paste) Text Properties")
;; ** Copy and Yank (Paste) Text Properties **
;;
;; You can highlight or unhighlight text by simply copying existing
;; highlighting (or lack of any highlighting) from anywhere in Emacs
;; and yanking (pasting) it anywhere else.
;;
;; Put differently, you can copy and yank a set of text properties.
;; You can use these commands to copy and yank any text properties,
;; not just `face' or `mouse-face'.
;;
;; To copy the text properties at a given position, use command
;; `hlt-copy-props'. You can then use command `hlt-yank-props' to
;; yank those properties to the active region anywhere. If the set
;; of properties that you copy is empty, then yanking means
;; effectively removing all text properties.
;;
;; User option `hlt-default-copy/yank-props' controls which text
;; properties to copy and yank, by default. The default value of the
;; option includes only `face', which means that only property `face'
;; is copied and pasted. That is typically what you want, for
;; highlighting purposes. A value of `t' for
;; `hlt-default-copy/yank-props' means use all properties.
;;
;; You can further control which text properties are copied or yanked
;; when you use the commands, by using a prefix argument. A plain or
;; non-negative prefix arg means copy or yank all available text
;; properties. A negative prefix arg (e.g. `C--') means you are
;; prompted for which text properties to use, among those available.
;;
;; For copying, the available properties are those among
;; `hlt-default-copy/yank-props' that are also present at the copy
;; position. For yanking, the available properties are those among
;; `hlt-default-copy/yank-props' that have previously (last) been
;; copied.
;;
;;(@* "User Option `hlt-act-on-any-face-flag'")
;; ** User Option `hlt-act-on-any-face-flag' **
;;
;; Library `highlight' generally acts only on faces that it controls,
;; that is, faces that you have explicitly asked it to use for
;; highlighting. It sets the text property or overlay property
;; `hlt-highlight' on such highlighted text, so that it can recognize
;; which faces it has responsibility for.
;;
;; Sometimes, you might want to hide and show text other than that
;; controlled by library `highlight'. Similarly, you might sometimes
;; want to navigate among faces other than those used for
;; highlighting. You can control this using option
;; `hlt-act-on-any-face-flag', which you can toggle at any time using
;; command `hlt-toggle-act-on-any-face-flag'.
;;
;;(@* "Hiding and Showing Text")
;; ** Hiding and Showing Text **
;;
;; You can hide and show text that you have highlighted. You will
;; want to read the Emacs-Lisp manual (Elisp), section Invisible
;; Text, to understand better what this entails. In particular, you
;; should understand that for library `highlight.el', hiding text
;; means adding the symbol naming the face to be hidden to both:
;;
;; 1. a text or overlay `invisible' property, making the text or
;; overlay susceptible to being hidden by buffer-local variable
;; `buffer-invisibility-spec', and
;;
;; 2. the buffer's `buffer-invisibility-spec', so that it in fact
;; becomes hidden.
;;
;; After text has been hidden this way, and unless the highlighting
;; has been removed completely by unhighlighting the text, the
;; `invisible' property of that text keeps the names of the faces
;; that have been applied to that text and hidden previously, even
;; after you show that text again. Showing a hidden face simply
;; removes it from the `buffer-invisibility-spec'; it does not change
;; any `invisible' properties.
;;
;; For example, if you hide face `foo' at some buffer position:
;;
;; 1. The `invisible' property of the text or overlay at that
;; position is updated to include `foo'. If there are no other
;; faces that have been applied to this text and then hidden, the
;; `invisible' property is just `(foo)'.
;;
;; 2. `buffer-invisibility-spec' is also updated to include `foo'.
;; This hides all text properties and overlay properties with
;; `invisible' property `foo', throughout the buffer. If there
;; are no other invisible faces in the buffer, then
;; `buffer-invisibility-spec' has value (foo).
;;
;; If you then show face `foo' at that same buffer position, there is
;; no change to the `invisible' property. `buffer-invisibility-spec'
;; is updated, by removing `foo': if it was (foo), it becomes ().
;;
;; There are several commands for hiding and showing highlighted
;; text. The basic commands for hiding and showing are
;; `hlt-hide-default-face' and `hlt-show-default-face', which you can
;; use to hide and show the face last used for highlighting. With a
;; prefix argument, you are prompted for a different face to hide or
;; show; it then becomes the default face for highlighting. You can
;; also change the default highlighting face at any time using
;; command `hlt-choose-default-face'.
;;
;;(@* "Hiding and Showing Text - Icicles Multi-Commands")
;; *** Hiding and Showing Text - Icicles Multi-Commands ***
;;
;; The other hide and show commands depend on your also using
;; Icicles, which is a set of libraries that offer enhanced
;; completion. Complete information about Icicles is here:
;; `https://www.emacswiki.org/emacs/Icicles'. You can obtain Icicles
;; here: `https://www.emacswiki.org/emacs/Icicles_-_Libraries'.
;;
;; The Icicles commands defined for `highlight.el' are the following:
;;
;; `icicle-choose-faces', `icicle-choose-invisible-faces',
;; `icicle-choose-visible-faces', `icicle-hide-faces',
;; `icicle-hide-only-faces', `icicle-show-faces',
;; `icicle-show-only-faces'.
;;
;; These are all Icicles multi-commands, which means that they each
;; let you choose multiple completion candidates or all candidates
;; that match your current input (a regexp). To use them you must
;; also use Icicles. You can use command `icicle-hide-faces' to hide
;; any number of visible faces. Any text is hidden that has that
;; face as a text property or an overlay property, depending on the
;; value of `hlt-use-overlays-flag'.
;;
;; Command `icicle-show-faces' is the opposite of
;; `icicle-hide-faces': it shows invisible text that has the faces
;; you choose. Neither `icicle-hide-faces' nor `icicle-show-faces'
;; has any effect on other faces, besides those you choose to hide or
;; show, respectively; they each do only one thing, hide or show.
;;
;; Command `icicle-hide-only-faces' hides the faces you choose, and
;; shows all other faces, and command `icicle-show-only-faces' does
;; the opposite. You can thus use these commands to specify exactly
;; what faces should be invisible and visible. Empty input means
;; none: If you choose no faces to hide (that is, hit `RET' with an
;; empty minibuffer), then all faces are made visible; if you choose
;; no faces to show, then all are hidden.
;;
;; Currently, face attributes for highlighting are combined when
;; overlays overlap, but the same is not true for text properties.
;; For example, if you highlight a word with face `foo', and then you
;; highlight it with face `bar', only `bar' remains as the face for
;; that word. With overlays, the attributes of the two faces are
;; composed. When you hide or show faces, this behavior difference
;; has an effect.
;;
;; You can hide text using the commands in this library for any of
;; the purposes that you might use invisible text in Emacs. This
;; gives you an easy, interactive way to control which sections of
;; text are seen by search and other Emacs tools. Use the regexp
;; highlighting commands, for instance, to highlight text
;; syntactically, and then hide that highlighted text. Or use
;; `hlt-highlighter' to sweep over text that you want to hide with
;; the mouse.
;;
;; Hiding and showing faces also provides a "conditional text"
;; feature similar to that available in desktop publishing
;; applications such as Adobe Framemaker. Publishers often use such
;; a feature to produce different output documents from the same
;; source document ("single sourcing"). You can use this feature
;; similarly, if you have an application (printing is one example)
;; that is sensitive to whether text is visible or invisible. One
;; caveat: Emacs faces are not saved when you save your file.
;;
;;(@* "What Gets Highlighted: Region, Buffer, New Text You Type")
;; ** What Gets Highlighted: Region, Buffer, New Text You Type **
;;
;; Most mention of the "region" in this commentary should really say
;; "active region or buffer". If the region is active and non-empty,
;; then only the text in the region is targeted by the commands in
;; this library. This lets you easily control the scope of
;; operations.
;;
;; If the region is not active or it is empty, then:
;;
;; - If `hlt-use-overlays-flag' is nil and there is no prefix arg,
;; then the face is applied to the next characters that you type.
;;
;; - Otherwise, the face is applied to the entire buffer (or the
;; current restriction, if the buffer is narrowed).
;;
;;(@* "Interaction with Font Lock")
;; ** Interaction with Font Lock **
;;
;; Any highlighting that uses text property `face' is overruled by
;; font-lock highlighting - font-lock wants to win. (This does not
;; apply to highlighting that uses overlays - font-lock has no effect
;; on overlays.) In many cases you can still highlight text, but
;; sooner or later font-lock erases that highlighting when it
;; refontifies the buffer.
;;
;; To prevent this interference of font-lock with other highlighting,
;; the typical Emacs approach is to fool font-lock into thinking that
;; it is font-lock highlighting, even when it does not involve
;; `font-lock-keywords'.
;;
;; But this has the effect that such highlighting is turned off when
;; `font-lock-mode' is turned off. Whether this is a good thing or
;; bad depends on your use case.
;;
;; In vanilla Emacs you have no choice about this. Either the
;; highlighting is not recognized by font-lock, which overrules it,
;; or it is recognized as "one of its own", in which case it is
;; turned off when font-lock highlighting is turned off. With
;; library `highlight.el' things are more flexible.
;;
;; First, there is option `hlt-face-prop', whose value determines the
;; highlighting property: Value `font-lock-face' means that the
;; highlighting is controlled by font-lock. Value `face' means that
;; `font-lock' does not recognize the highlighting.
;;
;; Second, for the case where the option value is `face', if you also
;; use library `font-lock+.el' then there is no interference by
;; font-lock - the highlighting is independent of font-lock. Library
;; `font-lock+.el' is loaded automatically by `highlight.el', if it
;; is in your `load-path'. It prevents font-locking from removing
;; any highlighting face properties that you apply using the commands
;; defined here.
;;
;; Then font-lock does not override this highlighting with its own,
;; and it does not turn this highlighting on and off. Depending on
;; your application, this can be quite important.
;;
;; The default value of option `hlt-face-prop' is `font-lock-face'.
;; If you want text-property highlighting that you add to be able to
;; persist and be independent of font-locking, then change the value
;; to `face' and put library `font-lock+.el' in your `load-path'.
;;
;; [If you also load library `facemenu+.el', then the same applies to
;; highlighting that you apply using the face menu: `font-lock+.el'
;; also protects that highlighting from interference by font-lock.]
;;
;;(@* "Suggested Bindings")
;; ** Suggested Bindings **
;;
;; Library `highlight.el' binds many of its commands to keys on the
;; prefix key `C-x X'. It also adds menu items to the `Region'
;; submenu of the `Edit' menu-bar menu, if you have a `Region'
;; submenu. To obtain this menu, load library `menu-bar+.el'.
;;
;; Here are some additional, suggested key bindings (`C-x C-y', `C-x
;; mouse-2', `C-x S-mouse-2', `C-S-p', and `C-S-n', respectively):
;;
;; (define-key ctl-x-map [(control ?y)] 'hlt-highlight)
;; (define-key ctl-x-map [(down-mouse-2)] 'hlt-highlighter)
;; (define-key ctl-x-map [(S-down-mouse-2)] 'hlt-eraser)
;; (global-set-key [(shift control ?p)] 'hlt-previous-highlight)
;; (global-set-key [(shift control ?n)] 'hlt-next-highlight)
;; (global-set-key [(control meta shift ?s)]
;; 'hlt-highlight-enclosing-list)
;;
;;(@* "See Also")
;; ** See Also **
;;
;; * `highlight-chars.el' - Provides ways to highlight different sets
;; of characters, including whitespace and Unicode characters. It
;; is available here:
;; https://www.emacswiki.org/emacs/download/highlight-chars.el (code)
;; https://www.emacswiki.org/emacs/ShowWhiteSpace#HighlightChars (doc)
;;
;; * `hi-lock.el' - The features of `highlight.el' are complementary
;; to those of vanilla Emacs library `hi-lock.el', so you can use
;; the two libraries together. See this page for a comparison:
;; https://www.emacswiki.org/emacs/HighlightTemporarily.
;;
;;(@* "Commands That Won't Work in Emacs 20")
;; ** Commands That Won't Work in Emacs 20 **
;;
;; The following commands and options work only for Emacs versions
;; more recent than Emacs 20:
;;
;; `hlt-act-on-any-face-flag', `hlt-hide-default-face',
;; `hlt-highlight-line-dups-region',
;; `hlt-highlight-property-with-value', `hlt-next-highlight',
;; `hlt-previous-highlight', `hlt-show-default-face',
;; `hlt-toggle-act-on-any-face-flag'.
;;
;;(@* "To Do")
;; ** To Do **
;;
;; 1. Add commands to show and hide boolean combinations of faces.
;;
;; 2. Faces are not accumulated as text properties.
;; Highlighting with one face completely replaces the previous
;; highlight. Overlays don't have this limitation. Text
;; properties need not have it either, but they do, for now.
;;
;;(@* "Acknowledgement")
;; ** Acknowledgement **
;;
;; Some parts of this library were originally based on a library of
;; the same name written and copyrighted by Dave Brennan,
;; brennan@hal.com, in 1992. I haven't been able to locate that
;; file, so my change log is the only record I have of what our
;; relative contributions are.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change Log:
;;
;;(@* "Change log")
;;
;; 2022/03/20 dadams
;; hlt-unhighlight-isearch-matches: Corrected defaulting STRING to isearch-string.
;; hlt-(un)highlight-isearch-matches:
;; If empty isearch-string then read STRING.
;; Corrected order of args in interactive spec.
;; Improved doc string.
;; In Commentary, mention differences from standard isearch-highlight-regexp (M-s h r).
;; 2021/03/18 dadams
;; Need to require facemenu.el now. No longer preloaded for Emacs 28+.
;; 2019/07/10 dadams
;; hlt-+/--highlight-regexp-region: Removed incrementing START in loop - useless.
;; 2019/07/09 dadams
;; hlt-+/--highlight-regexp-region:
;; forward-char in loop only when match empty text. Reported by Simon Katz.
;; 2018/12/28 dadams
;; hlt-(un)highlight-regions: Pass zz-izones as explicit arg to zz-izone-limits.
;; 2018/11/12 dadams
;; hlt-(next|previous)-highlight: Added optional arg WRAP-P. In general, just for interactive use.
;; Use WRAP-P in while tests.
;; 2018/10/20 dadams
;; hlt-highlight-isearch-matches: Fixed interactive spec: put STRING last, not first.
;; 2018/10/19 dadams
;; hlt-next-highlight: Corrected wrapping.
;; 2018/10/18 dadams
;; hlt-next-highlight: Do not wrap-around more than once.
;; 2018/09/18 dadams
;; hlt-hide-default-face: If FACE is nil then set it to hlt-last-face (in body, not just interactive).
;; 2017/10/15 dadams
;; Added: hlt-user-error. Use it for user errors.
;; hlt-highlighter, hlt-eraser: Better error message if drag out of window.
;; 2017/06/30 dadams
;; hlt-(un)highlight-regions: Define even if zones.el is not loaded. Uses zones.el only for interactive.
;; 2016/12/23 dadams
;; Added: hlt-string-match-p.
;; Faces hlt-regexp-level-*: Do not inherit.
;; hlt-highlight-region: If FACE is hlt-regexp-level-* then do not update hlt-last-face.
;; hlt-highlight-regexp-groups:
;; Highlight non-group parts using hlt-last-face. Use increasing overlay priorities.
;; 2016/12/19 dadams
;; hlt-regexp-level-*: Use default background, not isearch-face (typo), as base for hexrgb changes.
;; Fix :group (typo).
;; Require cl.el when compile, if Emacs 20.
;; 2016/12/18 dadams
;; Added:
;; hlt-highlight-regexp-groups-region, hlt-unhighlight-regexp-groups-region,
;; hlt-highlight-regexp-groups, hlt-regexp-level-1, hlt-regexp-level-2, hlt-regexp-level-3,
;; hlt-regexp-level-4, hlt-regexp-level-5, hlt-regexp-level-6, hlt-regexp-level-7, hlt-regexp-level-8.
;; hlt-+/--highlight-regexp-region:
;; If FACE is symbol :hlt-regexp-groups, then (un)highlight regexp groups and ignore NTH and BUFFERS.
;; hlt-face-prop: For Emacs < 22, default value is face, not font-lock-face.
;; 2016/11/03 dadams
;; hlt-(un)highlight-symbol: Added optional arg FACE. Removed unused args START and END.
;; 2015/12/04 dadams
;; Added: hlt-highlight-lines.
;; 2016/08/16 dadams
;; Renamed wide-n.el stuff to zones.el stuff.
;; 2015/08/06 dadams
;; hlt-read-bg/face-name: Bind icicle-unpropertize-completion-result-flag to t.
;; hlt-choose-default-face: Use %S, not %s, in message, so color names in a cons are shown as strings.
;; 2015/07/31 dadams
;; hlt-(un)highlight-regions: Use new wide-n-restrictions format: (NUM BEG END), not (NUM BEG . END).
;; 2015/07/11 dadams
;; Added: hlt-highlight-regions, hlt-highlight-regions-in-buffers,
;; hlt-unhighlight-regions, hlt-highlight-regions-in-buffers.
;; hlt-highlight-region-in-buffers: Added missing t for MSGP in interactive spec.
;; hlt-(un)highlight-region, hlt-+/--highlight-regexp-region, hlt-replace-highlight-face:
;; Do not ignore explicit START and END if not interactive.
;; Do nothing if START or END is a marker for a different buffer.
;; hlt-highlight-line-dups-region: Added missing local binding of IGNORE.
;; hlt-+/--read-bufs: Mention C-g in prompt, to end inputting.
;; 2015/06/17 dadams
;; Added: hlt-highlight-line-dups-region, hlt-line-dups-ignore-regexp.
;; 2015/04/05 dadams
;; Added: hlt-face-prop.
;; hlt-highlighter, hlt-unhighlight-for-overlay, hlt-highlight-region, hlt-replace-highlight-face,
;; hlt-yank-props, hlt-hide-default-face, hlt-next-highlight, hlt-highlight-faces-in-buffer:
;; Use value of hlt-face-prop, not symbol face.
;; hlt-highlighter, hlt-eraser, hlt-(un)highlight-region, hlt-yank-props:
;; Add font-lock-ignore only when hlt-face-prop is the symbol face.
;; hlt-overlays-priority: Changed default priority to 0, from 200.
;; 2015/04/03 dadams
;; Added: hlt-highlight-isearch-matches, hlt-unhighlight-isearch-matches.
;; Added: hlt-overlays-priority.
;; Use it in hlt-highlighter, hlt-highlight-region, hlt-mouse-face-each-line.
;; Bind isearch-mode-map keys M-s h h, M-s h u to hlt-(un)highlight-isearch-matches.
;; 2014/09/21 dadams
;; Added: hlt-replace-highlight-face-in-buffers, hlt-highlight-region-in-buffers,
;; hlt-highlight-region-in-buffers, hlt-replace-highlight-face-in-buffers,
;; hlt-unhighlight-regexp-region-in-buffers, hlt-unhighlight-region-for-face-in-buffers,
;; hlt-unhighlight-region-in-buffers, hlt-+/--read-regexp, hlt-+/--read-bufs.
;; hlt-unhighlight-for-overlay: Added MOUSEP arg. It no longer removes mouse-face without MOUSEP.
;; hlt(-un)-highlight(-regexp)-region, hlt-+/--highlight-regexp-region, hlt-unhighlight-region-for-face,
;; hlt-replace-highlight-face, hlt-region-or-buffer-limits:
;; Added BUFFERS arg - can act on multiple buffers.
;; hlt-(un)highlight-regexp-region: Corrected interactive spec.
;; hlt-unhighlight-region-for-face: Added MSGP arg.
;; hlt-+/--highlight-regexp-read-args: Use hlt-+/--read-regexp.
;; hlt-read-bg/face-name: If in Icicle mode, use WYSIWYG completion candidates.
;; 2014/05/27 dadams
;; hlt-(un)highlight-symbol: A prefix arg means act on all visible buffers.
;; 2014/02/25 dadams
;; Added: hlt-highlight-symbol, hlt-unhighlight-symbol.
;; hlt-+/--highlight-regexp-region: Prevent doing hlt-next-face more than once.
;; hlt-next-highlight: Interactive spec uses face at point if hlt-auto-faces-flag.
;; Use get-char-property, not get-text-property.
;; Wrap around.
;; Bind C-x X hs, C-x X us to hlt-(un)highlight-symbol.
;; 2014/02/19 dadams
;; hlt-+/--highlight-regexp-region:
;; If UNHIGHLIGHTP: Do not advance to hlt-next-face.
;; If FACE is nil, unhighlight for all faces.
;; 2014/02/06 dadams
;; hlt-+/--highlight-regexp-region: When hlt-auto-faces-flag, cycle to next face.
;; 2013/11/28 dadams
;; Renamed hlt-read-face-name to hlt-read-bg/face-name, and rewrote:
;; Added optional DEFAULT arg, read also color names. No longer use read-face-name.
;; (So no longer soft-require faces+.el.)
;; hlt-choose-default-face: Read color names also.
;; hlt-eraser, hlt-highlighter: Added optional arg FACE-NB. Show message.
;; hlt-highlight-region: If hlt-auto-faces-flag, use hlt-next-face.
;; 2013/11/24 dadams
;; Use equal, not eq, for face comparisons, since the value could be a property list.
;; 2013/11/15 dadams
;; Added: hlt-unhighlight-regexp-region, hlt-unhighlight-regexp-to-end,
;; hlt-+/--highlight-regexp-read-args, hlt-+/--highlight-regexp-region, hlt-read-face-name.
;; hlt-highlight-regexp-(region|to-end):
;; Use hlt-+/--highlight-regexp-read-args and hlt-+/--highlight-regexp-region.
;; hlt-highlight: Change use of prefix arg. Include hlt-unhighlight-regexp-region.
;; 2013/11/07 dadams
;; Added: hlt-highlight-enclosing-list.
;; 2013/09/15 dadams
;; Soft-require font-lock+.el (Emacs 22+).
;; 2013/07/24 dadams
;; Added: hlt-nonempty-region-p.
;; Renamed: Paste Text Properties to * to Region, except in menu-bar-edit-region-menu.
;; Wherever hlt-yank-props is used in menus: Enable only if hlt-nonempty-region-p and hlt-copied-props.
;; hlt-highlight-region, hlt-highlight-property-with-value:
;; Use hlt-nonempty-region-p, not just mark-active.
;; hlt-yank-props, hlt-region-or-buffer-limits: Use hlt-nonempty-region-p.
;; 2013/05/28 dadams
;; Require easymenu.el.
;; hlt-highlighter, hlt-eraser: Wrap with with-current-buffer. Thx to Michael Heerdegen.
;; 2012/07/11 dadams
;; hlt-(highlighter|eraser)-mouse: Skip over event of choosing menu item, for Emacs 20-21.
;; 2011/12/01 dadams
;; hlt-eraser: Fixed so it works backwards too. Thx to Michael Heerdegen.
;; hlt-unhighlight-region, hlt-replace-highlight-face, hlt-eraser: Use dolist, not mapcar.
;; 2011/11/04 dadams
;; hlt-default-copy/yank-props: Allow a value of t, for all props.
;; hlt-props-to-copy/yank: Handle t value of hlt-default-copy/yank-props.
;; 2011/10/31 dadams
;; hlt-highlight-regexp-region: No occurrences msg if no match, not msg how to unhighlight.
;; 2011/09/13 dadams
;; hlt-highlight-property-with-value: Corrected interactive spec for VALUES.
;; 2011/07/24 dadams
;; Moved to icicles-cmd2.el, renamed with prefix icicle- from hlt-, and corrected them:
;; hlt-(hide|show)(-only)-faces, hlt-choose(-(in)visible)-faces.
;; menu-bar-edit-menu, facemenu(-mouse)-menu: Added hlt-(copy|yank)-props.
;; 2011/07/23 dadams
;; Added: hlt-((mouse-)copy|yank|paste)-props, hlt-copied-props, hlt-subplist,
;; hlt-default-copy/yank-props, hlt-read-props-completing, hlt-props-to-copy/yank.
;; Added defgroup. Updated defcustom/defface to use :group highlight.
;; menu-bar-edit-region-menu: Added hlt-yank-props, hlt-unhighlight-region-for-face.
;; Removed needing region for highlighting enablement.
;; 2011/05/05 dadams
;; icicle-delete-if(-not) -> icicle-remove-if(-not). Former are obsolete.
;; hlt-hide-default-face, hlt-next-highlight: Use also memq, not just eq, to test for face.
;; 2011/01/04 dadams
;; Removed autoload cookies from non def* sexps and non-interactive functions.
;; Added some missing autoload cookies for commands.
;; 2010/11/26 dadams
;; Added: hlt-unhighlight-for-overlay.
;; hlt-eraser, hlt-unhighlight-region: Use hlt-unhighlight-for-overlay, not hlt-delete-highlight-overlay.
;; hlt-eraser: Update doc string to reflect new behavior.
;; 2009/09/24 dadams
;; Removed hlt-no-op - use function ignore instead.
;; 2009/08/02 dadams
;; Added: hlt(-mouse)-toggle-(link|property)-highlighting, hlt-(un)highlight-all-prop,
;; hlt-property-highlight, hlt-prop-highlighting-state.
;; 2009/07/31 dadams
;; Added: hlt-highlight-property-with-value, hlt-flat-list, hlt-set-intersection.
;; 2009/04/26 dadams
;; hlt-mouse-face-each-line: Bind inhibit-field-text-motion to t, for real eol.
;; 2008/01/17 dadams
;; Removed soft require of icicles.el.
;; 2007/11/27 dadams
;; hlt-highlight-regexp-region: If available, use icicle-read-string-completing.
;; 2007/08/12 dadams
;; Moved here from menu-bar+.el: Add to Edit>Region menu. Soft require menu-bar.el.
;; 2007/06/07 dadams
;; Use face-name-history or icicle-face-name-history, if defined, else face-name-history.
;; 2007/06/05 dadams
;; Added: hlt-(highlighter|eraser)-mouse.
;; 2007/06/04 dadams
;; Added: hlt-previous-use-overlays-flag-value.
;; hlt-use-overlays-flag: 3 values now; default is only.
;; hlt-eraser, hlt-unhighlight-region, hlt-hide-default-face, hlt-next-highlight:
;; Treat non-only, non-nil hlt-use-overlays-flag.
;; hlt-toggle-use-overlays-flag: Use hlt-previous-use-overlays-flag-value.
;; Updated doc.
;; 2007/06/03 dadams
;; Added: hlt-toggle-use-overlays-flag.
;; Don't even define hlt-act-on-any-face-flag for Emacs 20.
;; Renamed no-op to hlt-no-op. Removed soft require of misc-cmds.el.
;; 2007/06/02 dadams
;; Added: hlt-act-on-any-face-flag, hlt-add-listifying, hlt-add-to-invisibility-spec,
;; hlt-choose(-(in)visible)-faces, hlt-(hide|show)(-default-face|-only),
;; hlt-highlight-faces-in-buffer, hlt-set-union, hlt-toggle-act-on-any-face-flag.
;; Renamed: highlight-use-overlays-flag to hlt-use-overlays-flag,
;; highlight-max-region-no-warning to hlt-max-region-no-warning,
;; highlight-last-regexp to hlt-last-regexp, highlight-last-face to hlt-last-face,
;; highlight-face to hlt-choose-default-face,
;; highlight-highlighter to hlt-highlighter, highlight-eraser to hlt-eraser,