-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhole-line-or-region.elc
183 lines (152 loc) · 13.4 KB
/
whole-line-or-region.elc
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
;ELC
;;; Compiled by oxygen@oxygen-svr on Sun May 27 13:46:29 2012
;;; from file /home/oxygen/.emacs.d/elisp/whole-line-or-region.el
;;; in Emacs version 23.3.1
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#@52 Version number for 'whole-line-or-region' package.
(defconst whole-line-or-region-version "$Revision: 1.3 $" (#$ . 525))
#@47 Return 'whole-line-or-region' version number.
(defalias 'whole-line-or-region-version-number #[nil #@114 ("\301\302\"\210\303\304\"\207" . [whole-line-or-region-version string-match "[0123456789.]+" match-string 0])(#$ . 758) nil 3 (#$ . 652)])
#@41 Display 'whole-line-or-region' version.
(defalias 'whole-line-or-region-display-version #[nil #@110 ("\300\301\302 \"\207" . [message "whole-line-or-region version <%s>." whole-line-or-region-version-number])(#$ . 1007) nil 3 (#$ . 906) nil])
(custom-declare-group 'whole-line-or-region nil "Customization group for whole-line-or-region minor mode." :group 'editing-basics :group 'convenience)
#@52 Customization of the group 'whole-line-or-region'.
(defalias 'whole-line-or-region-customize #[nil #@62 ("\300\301!\207" . [customize-group "whole-line-or-region"])(#$ . 1412) nil 2 (#$ . 1307) nil])
#@179 Non-nil if whole-line-or-region minor mode is enabled.
Setting this variable directly does not take effect; use either
\[customize] or the function `whole-line-or-region-mode'.
(custom-declare-variable 'whole-line-or-region-mode 'nil '(#$ . 1515) :set #[(symbol value) "\301\206 \302!\207" [value whole-line-or-region-mode 0] 2] :initialize 'custom-initialize-default :type 'boolean :group 'whole-line-or-region)
#@978 List of functions for whole-line-or-region to swap.
When whole-line-or-region is activated, all original functions will be
replaced with their whole-line counterparts in the global keymap,
unless the optional keymap is specified (in which case it will be
replace in that map only). Similarly, when whole-line-or-region is
de-activated, the functions will be swapped back.
The default is to map the following:
o `copy-region-as-kill' -> `whole-line-or-region-copy-region-as-kill'
o `kill-region' -> `whole-line-or-region-kill-region'
o `kill-ring-save' -> `whole-line-or-region-kill-ring-save'
o `yank' -> `whole-line-or-region-yank'
In addition, the following functions are provided by the package for
your convenience:
o `whole-line-or-region-delete'
o `whole-line-or-region-comment-dwim'
o `whole-line-or-region-comment-dwim-2'
See the individual functions for more information on what they do and
suggested mappings.
(custom-declare-variable 'whole-line-or-region-extensions-alist ''((copy-region-as-kill whole-line-or-region-copy-region-as-kill nil) (kill-region whole-line-or-region-kill-region nil) (kill-ring-save whole-line-or-region-kill-ring-save nil) (yank whole-line-or-region-yank nil)) '(#$ . 1938) :type '(repeat (list :tag "Function Mappings:" (function :tag "Original Function") (function :tag "Whole-line Version") (variable :tag "Keymap (optional)"))) :group 'whole-line-or-region :set #[(symbol newval) " L\210\n\205\n \303 \207" [symbol newval whole-line-or-region-mode whole-line-or-region-bind-keys] 2])
#@151 String to display in mode-line when 'whole-line-or-region' is active.
Must start with a space. Changes will take effect next time emacs is
started.
(custom-declare-variable 'whole-line-or-region-mode-line-string '" WLR" '(#$ . 3530) :type 'string :group 'whole-line-or-region)
#@37 Hook to run when package is loaded.
(custom-declare-variable 'whole-line-or-region-load-hook 'nil '(#$ . 3815) :type 'hook :group 'whole-line-or-region)
#@60 Hook called when 'whole-line-or-region' mode is turned on.
(custom-declare-variable 'whole-line-or-region-on-hook 'nil '(#$ . 3974) :type 'hook :group 'whole-line-or-region)
#@61 Hook called when 'whole-line-or-region' mode is turned off.
(custom-declare-variable 'whole-line-or-region-off-hook 'nil '(#$ . 4154) :type 'hook :group 'whole-line-or-region)
#@250 Toggle use of whole-line-or-region minor mode.
This minor mode allows functions to operate on the current line if
they would normally operate on a region and region is currently
undefined.
Optional ARG turns mode on iff ARG is a positive integer.
(defalias 'whole-line-or-region-mode #[(&optional arg) #@329 ("\n\2030\n<\2060\303\n!\304V\2020? \232?\20550\203'0\305 \210\202*0\306 \210\307\20330\310\20240\311!)\207" . [whole-line-or-region-mode old-mode arg prefix-numeric-value 0 whole-line-or-region-bind-keys whole-line-or-region-restore-keys run-hooks whole-line-or-region-on-hook whole-line-or-region-off-hook])(#$ . 4648) nil 2 (#$ . 4337) "P"])
(byte-code "\302\236\204\f \302 DB\302\207" [minor-mode-alist whole-line-or-region-mode-line-string whole-line-or-region-mode] 2)
#@36 Copy region or PREFIX whole lines.
(defalias 'whole-line-or-region-copy-region-as-kill #[(prefix) #@95 ("\301\302\303#\207" . [prefix whole-line-or-region-call-with-region copy-region-as-kill t])(#$ . 5254) nil 4 (#$ . 5150) "p"])
#@42 Kill (cut) region or PREFIX whole lines.
(defalias 'whole-line-or-region-kill-region #[(prefix) #@87 ("\301\302\303#\207" . [prefix whole-line-or-region-call-with-region kill-region t])(#$ . 5491) nil 4 (#$ . 5389) "*p"])
#@36 Copy region or PREFIX whole lines.
(defalias 'whole-line-or-region-kill-ring-save #[(prefix) #@90 ("\301\302\303#\207" . [prefix whole-line-or-region-call-with-region kill-ring-save t])(#$ . 5718) nil 4 (#$ . 5619) "p"])
#@394 Yank (paste) previously killed text.
If the text to be yanked was killed with a whole-line-or-region
function *as* a whole-line, then paste it as a whole line (i.e. do not
break up the current line, and do not force the user to move point).
RAW-PREFIX is used to determine which string to yank, just as `yank'
would normally use it.
Optionally, pass in string to be "yanked" via STRING-IN.
(defalias 'whole-line-or-region-yank #[(raw-prefix &optional string-in) #@565 ("\2060\306 <\2030\307\2020 \310=\2030\311\2020 S\312\"i\313\307\314#\203S0\315 \316 \210\20370c\210\202;0\317 !\210\320\321\"\204E0\322c\210\323\n!\210\324\f\211T\325#)\202k0\203h0\203c0\203c0\326 \210c\202k0\317 !*\207" . [string-in raw-prefix saved-column string-to-yank beg delete-selection-mode current-kill 0 - -1 t get-text-property whole-line-or-region line-beginning-position beginning-of-line yank string-match "\n$" "\n" move-to-column remove-text-properties (whole-line-or-region nil) delete-active-region mark-active])(#$ . 6321) nil 4 (#$ . 5849) "*P"])
(byte-code "\300\301\302 \"\203 \303\304\305\306#\210\202 \303\304\305\307#\210\300\207" [string-match "Emacs 21" emacs-version put whole-line-or-region-yank delete-selection yank t] 4)
#@38 Delete region or PREFIX whole lines.
(defalias 'whole-line-or-region-delete #[(prefix) #@84 ("\301\302\"\207" . [prefix whole-line-or-region-call-with-region delete-region])(#$ . 7208) nil 3 (#$ . 7115) "*p"])
#@109 Call `comment-dwim' on current region or current line.
See `comment-dwim' for details of RAW-PREFIX usage.
(defalias 'whole-line-or-region-comment-dwim #[(raw-prefix) #@106 ("\301\302\303\304\305%\207" . [raw-prefix whole-line-or-region-call-with-prefix comment-dwim 1 nil t])(#$ . 7509) nil 6 (#$ . 7334) "*P"])
#@54 Call `comment-dwim' on region or PREFIX whole lines.
(defalias 'whole-line-or-region-comment-dwim-2 #[(prefix) #@96 ("\301\302\303\304$\207" . [prefix whole-line-or-region-call-with-prefix comment-dwim nil t])(#$ . 7773) nil 5 (#$ . 7656) "*p"])
#@794 Calls FN on region or CNT whole lines.
If region is defined simply call FN, passing in the start and end of
the current region.
If region is not currently defined, then define it temporarily as the
current line. Additionally, if CNT is set, expand region to cover the
next CNT whole lines (or previous CNT whole lines, if CNT is
negative). Before FN is called, mark the temporary region with a
special property if MARK-AS-WHOLE is non-nil (this is useful if the
text could be worked on with some future whole-line-or-region
function, and it makes sense to understand the context in which FN was
originally called, e.g. killing and yanking text; see
`whole-line-or-region-yank' for an example).
In either case, if SEND-PREFIX is non-nil, then PREFIX is passed into
FN as a third argument.
(defalias 'whole-line-or-region-call-with-region #[(fn &optional cnt mark-as-whole send-prefix prefix) #@120 ("\305\211\306\307\211 \n\f& \207" . [fn cnt mark-as-whole send-prefix prefix whole-line-or-region-base-call t nil])(#$ . 8814) nil 10 (#$ . 7911)])
#@743 Calls FN on region or CNT whole lines.
If region is defined simply call FN.
If region is not currently defined, then define it temporarily as the
current line. Additionally, if CNT is set, expand region to cover the
next CNT whole lines (or previous CNT whole lines, if CNT is
negative). Before FN is called, mark the temporary region with a
special property if MARK-AS-WHOLE is non-nil (this is useful if the
text could be worked on with some future whole-line-or-region
function, and it makes sense to understand the context in which FN was
originally called, e.g. killing and yanking text; see
`whole-line-or-region-yank' for an example).
In either case, if SEND-PREFIX is non-nil, then PREFIX is passed into
FN as the sole argument.
(defalias 'whole-line-or-region-call-with-prefix #[(fn &optional cnt mark-as-whole send-prefix prefix) #@118 ("\305\211\306\211\211 \n\f& \207" . [fn cnt mark-as-whole send-prefix prefix whole-line-or-region-base-call nil])(#$ . 9824) nil 10 (#$ . 8972)])
#@1029 Calls FN on region or CNT whole lines.
If region is defined simply call NORM-FN.
If region is not currently defined, then define it temporarily as the
current line. Additionally, if CNT is set, expand region to cover the
next CNT whole lines (or previous CNT whole lines, if CNT is
negative). Before WLR-FN is called, mark the temporary region with a
special property if MARK-AS-WHOLE is non-nil (this is useful if the
text could be worked on with some future whole-line-or-region
function, and it makes sense to understand the context in which WLR-FN was
originally called, e.g. killing and yanking text; see
`whole-line-or-region-yank' for an example).
In either case, if BEG-END is non-nil, then pass into FN the start and
end of the current region. PRE-ARGS and POST-ARGS are lists of
arguments to be passed into FN before (PRE-ARGS) and/or after
(POST-ARGS) the start and end of the current region (but only if
BEG-END is non-nil). Finally, if SEND-PREFIX is non-nil, then PREFIX
is passed into FN before POST-ARGS.
(defalias 'whole-line-or-region-base-call #[(norm-fn wlr-fn &optional beg-end pre-args post-args cnt mark-as-whole send-prefix prefix) #@909 ("\203B0`\306 U\204B0\307\n\2030\310\301\n\"\210\203%0\310\301`\"\210\310\301\306 \"\210\f\203/0\310\301C\"\210\203:0\310\301\"\210\311\312 #)\207i\313 \307\211\212\314 \315!\210\203p0\316\317\211T\320\316$\210\321!\210)\314\206w0\322T!\211b\210\307\n\203\2110\310\301\n\"\210\203\2310\310\301\"\210\310\301\"\210\f\203\2430\310\301C\"\210\203\2560\310\301\"\210\311\312_ #\210)\203\3200\316\313 \323\211T\324#\210\321!\210*)\325!,\207" . [mark-active args pre-args beg-end send-prefix prefix mark nil whole-line-or-region-append-to-list apply funcall buffer-modified-p line-beginning-position set-mark t put-text-property whole-line-or-region set-buffer-modified-p 1 remove-text-properties (whole-line-or-region nil) move-to-column post-args norm-fn end beg current-mod-state saved-column mark-as-whole inhibit-read-only cnt wlr-fn])(#$ . 11151) nil 6 (#$ . 9981)])
#@110 Bind keys according to `whole-line-or-region-extensions-alist'.
With optional SWITCH, restore keys instead.
(defalias 'whole-line-or-region-bind-keys #[(&optional switch) #@275 ("\306 \307\211\211\211\n\205D0@A\f@\fA@\310\f8\20360\311\n \20610\n#\210\2020\311\n \206?0\n#\210\2020.\207" . [whole-line-or-region-extensions-alist map wlr orig elem ext-alist current-global-map nil 2 substitute-key-definition gmap switch])(#$ . 12277) nil 6 (#$ . 12098)])
#@68 Restore keys according to `whole-line-or-region-extensions-alist'.
(defalias 'whole-line-or-region-restore-keys #[nil #@56 ("\300\301!\207" . [whole-line-or-region-bind-keys t])(#$ . 12714) nil 2 (#$ . 12590)])
#@662 Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
The test for presence of ELEMENT is done with `equal'.
If ELEMENT is added, it is added at the beginning of the list,
unless the optional argument APPEND is non-nil, in which case
ELEMENT is added at the end.
If you want to use `whole-line-or-region-append-to-list' on a variable that is not defined
until a certain package is loaded, you should put the call to `whole-line-or-region-append-to-list'
into a hook function that will be run only after loading the package.
`eval-after-load' provides one way to do this. In some cases
other hooks, such as major mode hooks, can do the job.
(defalias 'whole-line-or-region-append-to-list #[(list-var element) #@67 ("\302J <\2030 \2020 C\"L\207" . [list-var element append])(#$ . 13544) nil 4 (#$ . 12809)])
(byte-code "\300\301!\210\302\303!\207" [provide whole-line-or-region run-hooks whole-line-or-region-load-hook] 2)