bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18093: 24.4.50; `delsel.el' fixes for use with `completion.el'


From: Drew Adams
Subject: bug#18093: 24.4.50; `delsel.el' fixes for use with `completion.el'
Date: Wed, 23 Jul 2014 13:58:43 -0700 (PDT)

`delsel.el' should be updated to play well with library `completion.el'.
The following should be done (or equivalent):

1.
(put 'completion-separator-self-insert-command 'delete-selection t)
(put 'completion-separator-self-insert-autofilling 'delete-selection t)

2. If `last-command' is `complete' and `this-command' has
`delete-selection' property `supersede' or `kill', replace the last
inserted completion with the string that was completed.

(defun delete-active-region (&optional killp)
  (cond ((and (eq last-command 'complete) ; See `completion.el'.
              (boundp 'cmpl-last-insert-location))
         ;; Do not delete region if a `self-insert-command'.  Delete it only if 
a
         ;; supersede or a kill.
         (when (and (symbolp this-command)
                    (memq (get this-command 'delete-selection) '(supersede 
kill)))
           (delete-region (point) cmpl-last-insert-location) ; Free var here.
           (insert cmpl-original-string) ; Free var here.
           (setq completion-to-accept  nil))) ; Free var here.
        (killp                    ; Do not let `kill-region' change 
`this-command'
         (let (this-command)
           (if (or (> emacs-major-version 24)
                   (and (= emacs-major-version 24)  (< emacs-minor-version 4)))
               (kill-region (point) (mark) 'REGION)
             (kill-region (point) (mark)))))
        ((boundp 'region-extract-function) ; Emacs 24.4+
         (funcall region-extract-function 'delete-only))
        (t (delete-region (point) (mark))))
  (deactivate-mark)
  t)


In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-06-28 on ODIEONE
Bzr revision: 117431 rgm@gnu.org-20140628015517-eku6hj8mpgcvfnso
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''





reply via email to

[Prev in Thread] Current Thread [Next in Thread]