The documentation string for the command text-clone-create:
(text-clone-create START END &optional SPREADP SYNTAX)
Create a text clone of START...END at point.
Text clones are chunks of text that are automatically kept identical:
changes done to one of the clones will be immediately propagated to the other.
The buffer’s content at point ...
The Org documentation says
Many commands in Org work on the region if the region is active.
And indeed defining a region followed by C-c C-t acts on all headlines in that region. Note that customizable variable org-loop-over-headlines-in-active-region must be set.
A further way is to use the respective bulk agenda action. Possible steps are as follows:...
highlight-nonselected-windows is a variable defined in xdisp.c. Its default value is nil. A non-nil value means highlight region even in nonselected windows. You can customize this variable, e.g.:
(setq highlight-nonselected-windows t)
It's only you're having syntax issues, try this:
(defun copybuffer ()
"function takes current region, and writes it to specified file"
(write-region (region-beginning) (region-end) "~/copybuffer.txt"))
region-beginning and region-end are functions, so they have to be between parenthesis to be recognized as ...
M-| (M-x shell-command-on-region) runs a shell command using the region as stdin, display the output in the echo area, with a prefix arg, replace the region with the output.
Unlike your shell in a terminal, each use of M-! or M-|: start a shell such as bash, run the shell command, then kill the shell. And the region is data passed to the shell command, the ...
The first backspace kills the whole region.
You'll want to set delete-active-region to nil (it was introduced in 24.1).
delete-backward-char is an interactive compiled Lisp function in ‘simple.el’.
If Transient Mark mode is enabled, the mark is active, and N is 1,
delete the text in the region and deactivate the mark instead.
To disable this, set ...
Your question is unclear (to me). You say you want to "mark regex isearch results" (plural). But the code you show just marks the final result - final match when you exit Isearch.
Is that what you want: just set the region around the final match, so you can use C-w or M-w on it?
If so, what was wrong with this answer on the page of your first link?
You can do this with library Isearch+. As far as I know, this is the only library that offers this possibility.
Set or bind option isearchp-restrict-to-region-flag to non-nil. This means that when the region is active and you start isearching the search will be limited to the region.
Select the text between the upper-left and lower-right corners of the ...
Use (mouse-region-match). C-h f mouse-region-match says:
mouse-region-match is a compiled Lisp function in mouse.el.
Return non-nil if there's an active region that was set with the mouse.
Command mark-end-of-sentence does what you request. It's not bound to a key by default, but you can bind it to one. C-h f mark-end-of-sentence tells you:
mark-end-of-sentence is an interactive compiled Lisp function in
Put mark at end of sentence. Arg works as in forward-sentence.
If this command ...
Try adjusting downward the value for show-paren-priority -- "[p]riority of paren highlighting overlays" -- which has a default value of 1000. The priority for the active region is '(nil . 100), which is hard-coded in redisplay-highlight-region-function.
I think you have transient-mark-mode switched off. Without transient-mark-mode you do not get a highlighted region after setting mark with C-SPC and successive motion commands.
If the region is not highlighted, it is not active and (region-active-p) returns nil.
Even if the region is not active (point) and (mark) can give differing positions. That is the ...
Not 100% sure what you want to check for but if you wish to do something when the mouse has selected a region then here is one way to do it using Emacs advice functionality.
(defun register-mouse-select(&rest args)
(message "mouse select"))
(advice-add 'mouse-set-region :after #'register-mouse-select)
;;(advice-remove 'mouse-set-region #'register-...
This code should do what you want:
(setq your-variable (buffer-substring (region-beginning) (region-end)))
If you want a command, try this:
(defun my-set-var-to-selection (variable beg end)
"Set VARIABLE to a string with the selected text.
You are prompted for VARIABLE."
(list (intern (completing-read "...
I'm not sure if you can do this with rectangular regions, but it's a perfect situation for multiple cursors:
Fundamentals of multiple-cursors
In your case, starting with point before foobar1, call M-x set rectangular-region-anchor, navigate to the next line until you have a point before every foobar. Then ...
[ I'll answer the second question. ]
Yes, Emacs resets mark-active to nil automatically after executing a command which modified the buffer (or more specifically, after executing a command which set deactivate-mark to a non-nil value). To prevent that you can use (setq deactivate-mark nil) in your function (after performing the buffer modification).
Yes. Here are some ways.
With just vanilla Emacs you can narrow the buffer to the text between your two "markers", using C-x n n. You need only one marker - the mark, at one end of that bit of text, and point (the cursor position) at the other end of that bit of text.
With library Isearch+ you can just search the active region - no need to narrow the ...
To invoke a function, don't quote it: (kill-whole-line), not ('kill-whole-line).
You're looking for function use-region-p, so (use-region-p), not region-selected. (There is no predefined variable region-selected.)
You need to pass functions the arguments they require. So (kill-region (region-beginning) (region-end).
If you want it to be a function then ...
If you want to change them all to the same state with a single command you can use a function like this that works on a region or the buffer.
(defun j-change-todo (start end state)
"Change heading todo states in region defined by START and END to STATE.
Operate on whole buffer if no region is defined."
(if (region-active-p) (...