;; Making and deleting lines.
+(defvar self-insert-uses-region-functions nil
+ "Special hook to tell if `self-insert-command' will use the region.
+It must be called via `run-hook-with-args-until-success' with no arguments.
+Any `post-self-insert-command' which consumes the region should
+register a function on this hook so that things like `delete-selection-mode'
+can refrain from consuming the region.")
+
(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))
"Propertized string representing a hard newline character.")
(let ((minibuffer-completing-symbol t))
(minibuffer-with-setup-hook
(lambda ()
+ ;; FIXME: call emacs-lisp-mode?
+ (setq-local eldoc-documentation-function
+ #'elisp-eldoc-documentation-function)
(add-hook 'completion-at-point-functions
- #'lisp-completion-at-point nil t)
+ #'elisp-completion-at-point nil t)
(run-hooks 'eval-expression-minibuffer-setup-hook))
(read-from-minibuffer prompt initial-contents
read-expression-map t
"Test whether UNDO-ELT crosses one edge of that region START ... END.
This assumes we have already decided that UNDO-ELT
is not *inside* the region START...END."
+ (declare (obsolete nil "25.1"))
(cond ((atom undo-elt) nil)
((null (car undo-elt))
;; (nil PROPERTY VALUE BEG . END)
;; (BEGIN . END)
(and (< (car undo-elt) end)
(> (cdr undo-elt) start)))))
-(make-obsolete 'undo-elt-crosses-region nil "24.5")
(defun undo-adjust-elt (elt deltas)
"Return adjustment of undo element ELT by the undo DELTAS
;;;; Window system cut and paste hooks.
-(defvar interprogram-cut-function nil
+(defvar interprogram-cut-function #'gui-select-text
"Function to call to make a killed region available to other programs.
Most window systems provide a facility for cutting and pasting
text between different programs, such as the clipboard on X and
programs. The function takes one argument, TEXT, which is a
string containing the text which should be made available.")
-(defvar interprogram-paste-function nil
+(defvar interprogram-paste-function #'gui-selection-value
"Function to call to get text cut from other programs.
Most window systems provide a facility for cutting and pasting
text between different programs, such as the clipboard on X and
"Whether appending to kill ring also makes \\[undo] restore both pieces of text simultaneously."
:type 'boolean
:group 'killing
- :version "24.5")
+ :version "25.1")
(defun kill-append (string before-p)
"Append STRING to the end of the latest kill in the kill ring.
(signal 'mark-inactive nil)))
;; Behind display-selections-p.
-(declare-function x-selection-owner-p "xselect.c"
- (&optional selection terminal))
-(declare-function x-selection-exists-p "xselect.c"
- (&optional selection terminal))
(defun deactivate-mark (&optional force)
"Deactivate the mark.
;; the region prior to the last command modifying the buffer.
;; Set the selection to that, or to the current region.
(cond (saved-region-selection
- (x-set-selection 'PRIMARY saved-region-selection)
+ (gui-set-selection 'PRIMARY saved-region-selection)
(setq saved-region-selection nil))
;; If another program has acquired the selection, region
;; deactivation should not clobber it (Bug#11772).
((and (/= (region-beginning) (region-end))
- (or (x-selection-owner-p 'PRIMARY)
- (null (x-selection-exists-p 'PRIMARY))))
- (x-set-selection 'PRIMARY
- (funcall region-extract-function nil)))))
+ (or (gui-call gui-selection-owner-p 'PRIMARY)
+ (null (gui-call gui-selection-exists-p 'PRIMARY))))
+ (gui-set-selection 'PRIMARY
+ (funcall region-extract-function nil)))))
(when mark-active (force-mode-line-update)) ;Refresh toolbar (bug#16382).
(cond
((eq (car-safe transient-mark-mode) 'only)
0)
0)))
(if (floatp lsp)
- (setq lsp (* dfh lsp)))
+ (setq lsp (truncate (* (frame-char-height) lsp))))
(+ dfh lsp)))
(defun window-screen-lines ()
for `line-spacing', if any, defined for the window's buffer or frame.
The value is a floating-point number."
- (let ((canonical (window-text-height))
- (fch (frame-char-height))
+ (let ((edges (window-inside-pixel-edges))
(dlh (default-line-height)))
- (/ (* (float canonical) fch) dlh)))
+ (/ (float (- (nth 3 edges) (nth 1 edges))) dlh)))
;; Returns non-nil if partial move was done.
(defun line-move-partial (arg noerror to-end)
and drag it forward past ARG other characters (backward if ARG negative).
If no argument and at end of line, the previous two chars are exchanged."
(interactive "*P")
- (and (null arg) (eolp) (forward-char -1))
+ (when (and (null arg) (eolp) (not (bobp))
+ (not (get-text-property (1- (point)) 'read-only)))
+ (forward-char -1))
(transpose-subr 'forward-char (prefix-numeric-value arg)))
(defun transpose-words (arg)
This is always done when called interactively.
Optional third arg NORECORD non-nil means do not put this buffer at the
-front of the list of recently selected ones."
+front of the list of recently selected ones.
+
+Returns the newly created indirect buffer."
(interactive
(progn
(if (get major-mode 'no-clone-indirect)