[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dape 3d01c5f3b6 09/10: Add filename completion to read
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dape 3d01c5f3b6 09/10: Add filename completion to read config |
Date: |
Fri, 12 Jan 2024 10:04:11 -0500 (EST) |
branch: externals/dape
commit 3d01c5f3b66802261dba4f84fcbb9018738a856d
Author: Daniel Pettersson <daniel@dpettersson.net>
Commit: Daniel Pettersson <daniel@dpettersson.net>
Add filename completion to read config
---
dape.el | 69 +++++++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 44 insertions(+), 25 deletions(-)
diff --git a/dape.el b/dape.el
index 5b2d07b1df..7717ce3ab3 100644
--- a/dape.el
+++ b/dape.el
@@ -3595,36 +3595,52 @@ If SIGNAL is non nil raises an `user-error'."
(defun dape--config-completion-at-point ()
"Function for `completion-at-point' fn for `dape--read-config'."
- (pcase-let ((`(,key . ,args) (ignore-errors
- (read (format "(%s)" (thing-at-point
'line)))))
- (symbol-bounds (bounds-of-thing-at-point 'symbol))
- (line-bounds (bounds-of-thing-at-point 'line))
- (whitespace-bounds (bounds-of-thing-at-point 'whitespace)))
+ (let (key args args-bounds last-p)
+ (save-excursion
+ (goto-char (minibuffer-prompt-end))
+ (setq key
+ (ignore-errors (read (current-buffer))))
+ (ignore-errors
+ (while t
+ (setq last-p (point))
+ (push (read (current-buffer))
+ args)
+ (push (cons last-p (point))
+ args-bounds))))
+ (setq args (nreverse args)
+ args-bounds (nreverse args-bounds))
(cond
;; Complete config key
((or (not key)
- (and (not args) symbol-bounds))
- (let ((bounds (or line-bounds (cons (point) (point)))))
- (list (car bounds) (cdr bounds)
+ (and (not args)
+ (thing-at-point 'symbol)))
+ (pcase-let ((`(,start . ,end)
+ (or (bounds-of-thing-at-point 'symbol)
+ (cons (point) (point)))))
+ (list start end
(mapcar (lambda (suggestion) (format "%s " suggestion))
dape--minibuffer-suggestions))))
;; Complete config args
((and (alist-get key dape-configs)
- (or (and (not (dape--plistp args))
- symbol-bounds)
- (and (dape--plistp args)
- whitespace-bounds)))
- (let ((args (if symbol-bounds
- (nreverse (cdr (nreverse args)))
- args))
- (bounds (or symbol-bounds (cons (point) (point))))
- (base-config (append (alist-get key dape-configs)
- (cons 'compile nil))))
- (list (car bounds) (cdr bounds)
- (cl-loop for (key _) on base-config by 'cddr
- unless (plist-member args key)
- when (or (eq key 'compile) (keywordp key))
- collect (format "%s " key))))))))
+ (or (and (plistp args)
+ (thing-at-point 'whitespace))
+ (cl-loop with p = (point)
+ for ((start . end) _) on args-bounds by 'cddr
+ when (and (<= start p) (<= p end))
+ return t
+ finally return nil)))
+ (pcase-let ((`(,start . ,end)
+ (or (bounds-of-thing-at-point 'symbol)
+ (cons (point) (point)))))
+ (list start end
+ (cl-loop with plist = (append (alist-get key dape-configs)
+ '(compile nil))
+ for (key _) on plist by 'cddr
+ collect (format "%s " key)))))
+ (t
+ (list (point) (point)
+ nil
+ :exclusive 'no)))))
(defun dape--read-config ()
"Read config from minibuffer.
@@ -3659,8 +3675,11 @@ See `dape--config-mode-p' how \"valid\" is defined."
(minibuffer-with-setup-hook
(lambda ()
(setq-local dape--minibuffer-suggestions
- (append from-dape-commands suggested-configs))
+ (append from-dape-commands suggested-configs)
+ comint-completion-addsuffix nil)
(set-syntax-table emacs-lisp-mode-syntax-table)
+ (add-hook 'completion-at-point-functions
+ 'comint-filename-completion nil t)
(add-hook 'completion-at-point-functions
#'dape--config-completion-at-point nil t))
(pcase-let* ((str
@@ -3669,7 +3688,7 @@ See `dape--config-mode-p' how \"valid\" is defined."
initial-contents
(let ((map (make-sparse-keymap)))
(set-keymap-parent map
minibuffer-local-map)
- (define-key map "C-M-i"
#'completion-at-point)
+ (define-key map (kbd "C-M-i")
#'completion-at-point)
(define-key map "\t"
#'completion-at-point)
map)
nil 'dape-history
initial-contents)))
- [elpa] externals/dape updated (4393b10a53 -> 3673a55dd3), ELPA Syncer, 2024/01/12
- [elpa] externals/dape 2b54df1d25 02/10: Fix startDebugging request for debugpy process start, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 3673a55dd3 10/10: Fix stacktrace face, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 3d01c5f3b6 09/10: Add filename completion to read config,
ELPA Syncer <=
- [elpa] externals/dape d730e3f4f2 06/10: Improve look of config barf on error, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 7e184d193a 03/10: Add option to align variables table, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 552683b9a8 04/10: Add overlay description for exception errors, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 043cf44d09 07/10: `dape-info' now toggles buffers when called as a command, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 400082bc9b 01/10: Fix removal of log and expression breakpoints, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 371e88daec 08/10: Fix issue where stack shows stack trace even if continued, ELPA Syncer, 2024/01/12
- [elpa] externals/dape 1ec1b243c9 05/10: Improve usability of goto breakpoint in info buffer, ELPA Syncer, 2024/01/12