[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 624685d575 1/6: REMOVE mct-backward-updir; document
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 624685d575 1/6: REMOVE mct-backward-updir; document it instead |
Date: |
Wed, 9 Feb 2022 01:57:38 -0500 (EST) |
branch: externals/mct
commit 624685d575b4190e019f305b5ffa7453a35b9179
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
REMOVE mct-backward-updir; document it instead
This is part of the plan to keep the mct.el code focused on the core
functionality.
Thanks to Chris Burroughs for the feedback in issue 3 over at the GitHub
mirror: <https://github.com/protesilaos/mct/issues/3>.
---
README.org | 84 ++++++++++++++++++++++++++++++++++++++------------------------
mct.el | 33 ++----------------------
2 files changed, 54 insertions(+), 63 deletions(-)
diff --git a/README.org b/README.org
index a9bedddb71..ee9ceedc17 100644
--- a/README.org
+++ b/README.org
@@ -679,31 +679,18 @@ Completions' buffer
([[#h:97eb5898-1e52-4338-bd55-8c52f9d8ccd3][Cyclic behaviour
immediately exit the minibuffer with the completed candidate as the
selected one.
-** Other commands for mct-minibuffer-mode
-:PROPERTIES:
-:CUSTOM_ID: h:b46a3366-6a7a-49ed-8caa-693d6ee437e9
-:END:
-#+cindex: Miscellaneous commands for minibuffer completion
-
- #+findex: mct-next-completion-group
- #+findex: mct-previous-completion-group
-+ Emacs 28 has the ability to group candidates inside the completions'
- buffer under headings. For example, the Consult package makes good
- use of those ([[#h:03227254-d467-4147-b8cf-2fe05a2e279b][Extensions]]). MCT
provides motions that jump between
- such headings, placing the point at the first candidate right below
- the heading's text. Use =M-n= (~mct-next-completion-group~) and =M-p=
- (~mct-previous-completion-group~) to move to the next or previous one,
- respectively. Both commands accept an optional numeric argument. For
- the sake of avoiding surprises, these commands do not cycle between
- the completions and the minibuffer: they stop at the first or last
- heading.
-
- #+findex: mct-backward-updir
-+ When using completion categories that involve file paths, such as
- ~find-file~, the backspace key (=DEL=) goes up a directory if point is
- right after a path's directory delimiter (a forward slash). Otherwise
- it deletes a single character backwards. The command's symbol is
- ~mct-backward-updir~.
+ #+findex: mct-next-completion-group
+ #+findex: mct-previous-completion-group
+8. Emacs 28 has the ability to group candidates inside the completions'
+ buffer under headings. For example, the Consult package makes good
+ use of those ([[#h:03227254-d467-4147-b8cf-2fe05a2e279b][Extensions]]).
MCT provides motions that jump between
+ such headings, placing the point at the first candidate right below
+ the heading's text. Use =M-n= (~mct-next-completion-group~) and =M-p=
+ (~mct-previous-completion-group~) to move to the next or previous one,
+ respectively. Both commands accept an optional numeric argument.
+ For the sake of avoiding surprises, these commands do not cycle
+ between the completions and the minibuffer: they stop at the first or
+ last heading.
** Interaction model of mct-region-mode
:PROPERTIES:
@@ -1120,6 +1107,40 @@ Use `mct-sort-sort-by-alpha-length' if no history is
available."
[[#h:1f42c4e6-53c1-4e8a-81ef-deab70822fa4][Known completion categories]].
+** Ido-style navigation through directories
+:PROPERTIES:
+:CUSTOM_ID: h:9a6746dd-0be9-4e29-ac40-0af9612d05a2
+:END:
+
+[ Part of {{{development-version}}}. ]
+
+Older versions of MCT had a command for file navigation that would
+delete the whole directory component before point, effectively going
+back up one directory. While the functionality can be useful, it is not
+integral to the MCT experience and thus should not belong in =mct.el=.
+Add this to your own configuration file instead:
+
+#+begin_src emacs-lisp
+;; Adaptation of `icomplete-fido-backward-updir'.
+(defun my-backward-updir ()
+ "Delete char before point or go up a directory."
+ (interactive nil mct-minibuffer-mode)
+ (cond
+ ((and (eq (char-before) ?/)
+ (eq (mct--completion-category) 'file))
+ (when (string-equal (minibuffer-contents) "~/")
+ (delete-minibuffer-contents)
+ (insert (expand-file-name "~/"))
+ (goto-char (line-end-position)))
+ (save-excursion
+ (goto-char (1- (point)))
+ (when (search-backward "/" (minibuffer-prompt-end) t)
+ (delete-region (1+ (point)) (point-max)))))
+ (t (call-interactively 'backward-delete-char))))
+
+(define-key minibuffer-local-filename-completion-map (kbd "DEL")
#'my-backward-updir)
+#+end_src
+
** MCT in the current or the other window
:PROPERTIES:
:CUSTOM_ID: h:891c7841-9cdc-42df-bba9-45f7409b807c
@@ -1363,10 +1384,9 @@ They all make for a natural complement to the standard
Emacs experience
of the end-user. ~fido-mode~ and its accoutrements are defined in
=icomplete.el=.
- What MCT borrows from Icomplete is the ~mct-backward-updir~ command, the
- tidying of the shadowed file paths, and ideas for the input delay
- (explained elsewhere in this document). Internally, I also learnt how
- to extend local keymaps by studying =icomplete.el=.
+ What MCT borrows from Icomplete is for the input delay (explained
+ elsewhere in this document). Internally, I also learnt how to extend
+ local keymaps by studying =icomplete.el=.
I had used Icomplete for several months before moving to what now has
become =mct.el=. I think it is excellent at providing a thin layer over
@@ -1387,9 +1407,9 @@ MCT is meant to be a collective effort. Every bit of
help matters.
Kaludercic.
+ Ideas and user feedback :: Andrew Tropin, Benjamin (@zealotrush), Case
- Duckworth, Jonathan Irving, José Antonio Ortega Ruiz, Kostadin Ninev,
- Manuel Uberti, Philip Kaludercic, Theodor Thornhill, Tomasz
- Hołubowicz, Z.Du. As well as users: danrobi11.
+ Duckworth, Chris Burroughs, Jonathan Irving, José Antonio Ortega Ruiz,
+ Kostadin Ninev, Manuel Uberti, Philip Kaludercic, Theodor Thornhill,
+ Tomasz Hołubowicz, Z.Du. As well as users: danrobi11.
+ Packaging :: Andrew Tropin and Nicolas Goaziou (Guix).
diff --git a/mct.el b/mct.el
index fe08f527a6..08e290de33 100644
--- a/mct.el
+++ b/mct.el
@@ -608,25 +608,6 @@ by `mct--completions-window-name'."
(minibuffer-hide-completions)
(mct--show-completions)))
-;;;;; Commands for file completion
-
-;; Adaptation of `icomplete-fido-backward-updir'.
-(defun mct-backward-updir ()
- "Delete char before point or go up a directory."
- (interactive nil mct-minibuffer-mode)
- (cond
- ((and (eq (char-before) ?/)
- (eq (mct--completion-category) 'file))
- (when (string-equal (minibuffer-contents) "~/")
- (delete-minibuffer-contents)
- (insert (expand-file-name "~/"))
- (goto-char (line-end-position)))
- (save-excursion
- (goto-char (1- (point)))
- (when (search-backward "/" (minibuffer-prompt-end) t)
- (delete-region (1+ (point)) (point-max)))))
- (t (call-interactively 'backward-delete-char))))
-
;;;;; Cyclic motions between minibuffer and completions' buffer
(defun mct--completion-at-point-p ()
@@ -1176,12 +1157,6 @@ region.")
map)
"Derivative of `minibuffer-local-completion-map'.")
-(defvar mct-minibuffer-local-filename-completion-map
- (let ((map (make-sparse-keymap)))
- (define-key map (kbd "DEL") #'mct-backward-updir)
- map)
- "Derivative of `minibuffer-local-filename-completion-map'.")
-
(defun mct--setup-completion-list-keymap ()
"Set up completion list keymap."
(use-local-map
@@ -1189,14 +1164,10 @@ region.")
(current-local-map))))
(defun mct--setup-keymap ()
- "Set up minibuffer keymaps."
+ "Set up minibuffer keymap."
(use-local-map
(make-composed-keymap mct-minibuffer-local-completion-map
- (current-local-map)))
- (when (eq (mct--completion-category) 'file)
- (use-local-map
- (make-composed-keymap mct-minibuffer-local-filename-completion-map
- (current-local-map)))))
+ (current-local-map))))
(defun mct--setup-completion-list ()
"Set up the completion-list for Mct."
- [elpa] externals/mct updated (7195641421 -> a038b4c194), ELPA Syncer, 2022/02/09
- [elpa] externals/mct d6fcfd0da1 2/6: Rename internal function, ELPA Syncer, 2022/02/09
- [elpa] externals/mct b70f4ca230 5/6: Remove superfluous dot, ELPA Syncer, 2022/02/09
- [elpa] externals/mct a038b4c194 6/6: REMOVE the CRM tag; document it instead, ELPA Syncer, 2022/02/09
- [elpa] externals/mct 84e4eb4f2b 4/6: Reword doc string for hiding the mode line, ELPA Syncer, 2022/02/09
- [elpa] externals/mct 624685d575 1/6: REMOVE mct-backward-updir; document it instead,
ELPA Syncer <=
- [elpa] externals/mct 7c08a297e2 3/6: Minor clarification in the manual, ELPA Syncer, 2022/02/09