kill-new
and kill-append
.
The function kill-new
adds a string to the front of the kill ring.
Use kill-append
to add a string to a previous kill. The second
argument before-p, if non-nil
, says to add the string at
the beginning; otherwise, it goes at the end.
Both of these functions apply interprogram-cut-function
to the
entire string of killed text that ends up at the beginning of the kill
ring.
current-kill
rotates the yanking pointer in the
kill ring by n places, and returns the text at that place in the
ring. If the optional second argument do-not-move is
non-nil
, it doesn't actually move the yanking point; it just
returns the nth kill forward. If n is zero, indicating a
request for the latest kill, current-kill
calls
interprogram-paste-function
(documented below) before consulting
the kill ring.
All Emacs Lisp programs should either use current-kill
,
kill-new
, and kill-append
to manipulate the kill ring, or
be sure to call interprogram-paste-function
and
interprogram-cut-function
as appropriate.
interprogram-paste-function
and
interprogram-cut-function
exist so that you can provide functions
to transfer killed text to and from other programs.
kill-region
function can now be used in read-only buffers.
It beeps, but adds the region to the kill ring without deleting it.
compare-buffer-substrings
lets you compare two
substrings of the same buffer or two different buffers. Its arguments
look like this:
(compare-buffer-substrings buf1 beg1 end1 buf2 beg2 end2)The first three arguments specify one substring, giving a buffer and two positions within the buffer. The last three arguments specify the other substring in the same way. The value is negative if the first substring is less, positive if the first is greater, and zero if they are equal. The absolute value of the result is one plus the index of the first different characters.
overwrite-binary-mode
to t
.
mark-active
, which is always local in all buffers,
indicates whether the mark is active: non-nil
means yes.
When the mark is inactive, the function mark
normally gets an
error. However, (mark t)
returns the position of the inactive
mark.
The function push-mark
normally does not activate the mark.
However, it accepts an optional third argument activate which,
if non-nil
, says to activate.
A command can request deactivation of the mark upon return to the editor
command loop by setting deactivate-mark
to a non-nil
value. Transient Mark mode works by causing the command loop to take
note of deactivate-mark
and actually deactivate the mark.
Transient Mark mode enables highlighting of the region when the mark is
active. This is currently implemented only under the X Window System.
A few other commands vary their behavior slightly in this case, by
testing transient-mark-mode
. More specifically, they avoid
special display actions such as moving the cursor temporarily, which are
not needed when the region is shown by highlighting.
The variables activate-mark-hook
and deactivate-mark-hook
are normal hooks run, respectively, when the mark becomes active and when
it becomes inactive. The hook activate-mark-hook
is also run at
the end of a command if the mark is active and the region may have
changed.
move-to-column
now accepts a second optional
argument force, in addition to column; if the requested
column column is in the middle of a tab character and force
is non-nil
, move-to-column
replaces the tab with the
appropriate sequence of spaces so that it can place point exactly at
column.
t
. This affects the functions
search-forward
, search-backward
,
word-search-forward
, word-search-backward
,
re-search-forward
, and re-search-backward
.
match-beginning
and match-end
. Also, these
parenthetical groupings may now be nested to any degree.
(progn (string-match "f\\(o\\)*" "foo") (list (match-beginning 1) (match-end 1)))returns
(2 3)
in Emacs 19, corresponding to just the last
repetition of `\(o\)'. In Emacs 18, that expression returns
(1 3)
, encompassing both repetitions.
If you want the Emacs 18 behavior, use a grouping containing the
asterisk: "f\\(o*\\)"
.
save-match-data
preserves the regular
expression match status. Usage: (save-match-data
body...)
.
translate-region
applies a translation table to the
characters in a part of the buffer. Invoke it as
(translate-region start end table)
; start
and end bound the region to translate.
The translation table table is a string; (aref table
ochar)
gives the translated character corresponding to
ochar. If the length of table is less than 256, any
characters with codes larger than the length of table are not
altered by the translation.
translate-region
returns the number of characters which were
actually changed by the translation. This does not count characters
which were mapped into themselves in the translation table.
before-change-function
and after-change-function
.
If before-change-function
is non-nil
, then it is called
before any buffer modification. Its arguments are the beginning and end
of the region that is going to change, represented as integers. The
buffer that's about to change is always the current buffer.
If after-change-function
is non-nil
, then it is called
after any buffer modification. It takes three arguments: the beginning
and end of the region just changed, and the length of the text that
existed before the change. (To get the current length, subtract the
region beginning from the region end.) All three arguments are
integers. The buffer that has just changed is always the current
buffer.
Both of these variables are temporarily bound to nil
during the
time that either of these hooks is running. This means that if one of
these functions changes the buffer, that change won't run these
functions. If you do want hooks to be run recursively, write your hook
functions to bind these variables back to their usual values.
first-change-hook
is run using run-hooks
whenever
a buffer is changed that was previously in the unmodified state.
insert-abbrev-table-description
is
now optional.