(define-key map [mouse-3] nil)
(define-key map [down-mouse-3] context-menu-entry)
(define-key map [menu] #'context-menu-open)
- (if (featurep 'w32)
- (define-key map [apps] #'context-menu-open))
- (when (featurep 'ns)
- (define-key map [C-mouse-1] nil)
- (define-key map [C-down-mouse-1] context-menu-entry))
+ (if (featurep 'w32) (define-key map [apps] #'context-menu-open))
map)
"Context Menu mode map.")
;; By binding these to down-going events, we let the user use the up-going
;; event to make the selection, saving a click.
-(global-set-key [C-down-mouse-1] #'mouse-buffer-menu)
+;; (global-set-key [C-down-mouse-1] #'mouse-buffer-menu)
(if (not (eq system-type 'ms-dos))
(global-set-key [S-down-mouse-1] #'mouse-appearance-menu))
;; C-down-mouse-2 is bound in facemenu.el.
\f
;; Define the major mode for lists of completions.
+(defun completions-apply (e)
+ (interactive "e")
+ (with-current-buffer (window-buffer (posn-window (event-end e)))
+ (let ((str (get-text-property (posn-point (event-start e)) 'completion--string))
+ (prf (car completion-base-affixes))
+ (act (car completions-action)))
+ (with-current-buffer completion-reference-buffer
+ (when-let ((adjust-fn (alist-get 'adjust-base-function
+ (completion-metadata
+ (concat prf str)
+ minibuffer-completion-table
+ minibuffer-completion-predicate))))
+ (setq prf (funcall adjust-fn prf)))
+ (funcall act (concat prf str)))
+ (save-excursion
+ (goto-char (point-min))
+ (when-let ((pm (text-property-search-forward
+ 'completion--string str t)))
+ (goto-char (prop-match-beginning pm))
+ (setq pm (text-property-search-forward 'cursor-face))
+ (let ((inhibit-read-only t))
+ (add-face-text-property (prop-match-beginning pm) (point)
+ 'completions-used-input)))))))
+
(defvar-keymap completion-list-mode-map
:doc "Local map for completion list buffers."
"RET" #'choose-completion
"<mouse-2>" #'choose-completion
+ "C-<mouse-1>" #'completions-apply
"<up>" #'previous-line-completion
"<down>" #'next-line-completion
"<left>" #'previous-completion