[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/crux 2e16b82 087/112: Rework `move-to-mode-line-start` to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/crux 2e16b82 087/112: Rework `move-to-mode-line-start` to add extensibility (#71) |
Date: |
Wed, 11 Aug 2021 09:57:59 -0400 (EDT) |
branch: elpa/crux
commit 2e16b828910c9b8acba37e712d21b517d2cf78cc
Author: Matthew Newton <matt@mnewton.com>
Commit: GitHub <noreply@github.com>
Rework `move-to-mode-line-start` to add extensibility (#71)
---
crux.el | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/crux.el b/crux.el
index 19ed53c..fa9259c 100644
--- a/crux.el
+++ b/crux.el
@@ -58,6 +58,23 @@
:type 'list
:group 'crux)
+(defcustom crux-line-start-regex-alist
+ '((term-mode . "^[^#$%>\n]*[#$%>] ")
+ (eshell-mode . "^[^$\n]*$ ")
+ (org-mode . "^\\(\*\\|[[:space:]]*\\)* ")
+ (default . "^[[:space:]]*"))
+ "Alist of major modes and line starts.
+
+The key is a major mode. The value is a regular expression
+matching the characters to be skipped over. If no major mode is
+found, use the regex specified by the default key.
+
+Used by crux functions like `crux-move-beginning-of-line' to skip
+over whitespace, prompts, and markup at the beginning of the line."
+ :type 'list
+ :group 'crux)
+
+
(defcustom crux-shell (getenv "SHELL")
"The default shell to run with `crux-ansi-term'."
:type 'string
@@ -277,26 +294,14 @@ Passes ARG to command `kill-whole-line' when provided."
(kill-line 0)
(indent-according-to-mode))
-(defvar crux-line-start-regex-term-mode "^[^#$%>\n]*[#$%>] "
- "Match terminal prompts.
-
-Used by crux functions like crux-move-beginning-of-line to skip over the
prompt")
-
-(defvar crux-line-start-regex-eshell-mode "^[^$\n]*$ " "Match eshell prompt.
-
-Used by crux functions like crux-move-beginning-of-line to skip over the
prompt")
-
-(defvar crux-line-start-regex "^[[:space:]]*" "Match whitespace in from of
line.
-
-Used by crux functions like crux-move-beginning-of-line to skip over
whitespace")
-
(defun move-to-mode-line-start ()
"Move to the beginning, skipping mode specific line start regex."
(interactive)
(move-beginning-of-line nil)
- (let ((line-start-regex (cond ((eq major-mode 'term-mode)
crux-line-start-regex-term-mode)
- ((eq major-mode 'eshell-mode)
crux-line-start-regex-eshell-mode)
- (t crux-line-start-regex))))
+ (let ((line-start-regex (cdr (seq-find
+ (lambda (e) (derived-mode-p (car e)))
+ crux-line-start-regex-alist
+ (assoc 'default
crux-line-start-regex-alist)))))
(search-forward-regexp line-start-regex (line-end-position) t)))
;;;###autoload
- [nongnu] elpa/crux 3e03d72 049/112: Don't use dash.el function (#34), (continued)
- [nongnu] elpa/crux 3e03d72 049/112: Don't use dash.el function (#34), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux b60d9f4 051/112: Fix a compilation warning, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 54cc9b8 056/112: Fix typo in crux-top-join-line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 11096b9 058/112: Fix typo in keybindings (#47), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux cedec52 063/112: Mark crux-recentf-ido-find-file as obsolete, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 66954bf 022/112: Mention crux-indent-defun, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 3042f6f 029/112: Add some contribution guidelines, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 225b5e3 042/112: Merge pull request #29 from Wilfred/rename_file_and_buffer_tweaks, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 6ae09d0 045/112: Add functions on duplicate current line or region (#31), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 4302357 052/112: Make crux-visit-term-buffer ask to restart dead process (#36), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 2e16b82 087/112: Rework `move-to-mode-line-start` to add extensibility (#71),
ELPA Syncer <=
- [nongnu] elpa/crux bb5a133 090/112: Simplify a bit of code, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 1fa7162 091/112: Optionally move visually in `move-to-mode-line-start', ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux dcd693c 093/112: Rename move-to-mode-line-start to crux-move-to-mode-line-start, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e805ab7 057/112: Use synchronous process for crux-open-with, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 4f5c8fe 059/112: [Fix #46] Address two issues with crux-move-beginning-line (#48), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 49dc7d7 067/112: Remove unused prefix argument from crux-smart-kill-line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 903db7b 080/112: Add history on crux and links to emacsredux blog posts, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux ba4a1f3 098/112: Restructure the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux a0a34d1 100/112: Fix defcustom types, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux acaaa00e 065/112: Bump the copyright years, ELPA Syncer, 2021/08/11