emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/crux 1fa7162 091/112: Optionally move visually in `move-to


From: ELPA Syncer
Subject: [nongnu] elpa/crux 1fa7162 091/112: Optionally move visually in `move-to-mode-line-start'
Date: Wed, 11 Aug 2021 09:58:00 -0400 (EDT)

branch: elpa/crux
commit 1fa71625239dac8f7e8b59be21e5795b7b34c819
Author: Miquel Sabaté Solà <msabate@suse.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Optionally move visually in `move-to-mode-line-start'
    
    In some environments users expect crux's functions to respect visual lines. 
This
    can now be configured through the `crux-should-move-visually' configurable
    variable. If set to true, then `move-to-mode-line-start' will use take into
    account visual lines. Otherwise (the default behavior), it will work as 
usual by
    moving to the logical beginning of the line.
    
    For functions like `crux-move-beginning-of-line', specifically, the user 
will
    face the following situation when setting `crux-should-move-visually; to 
true:
    
    1. If the user runs this function in the middle of a visual line, it will 
go to
       the beginning of said visual line.
    2. If the user runs this function again, then it will go to the beginning 
of the
       real line.
    3. If the user runs this function again, then it will go to the first 
non-space
       character of the line.
    
    Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
---
 crux.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/crux.el b/crux.el
index 1580be5..5eff1cc 100644
--- a/crux.el
+++ b/crux.el
@@ -135,6 +135,12 @@ expected name of the shell buffer."
   :type 'symbol
   :group 'crux)
 
+(defcustom crux-should-move-visually
+  nil
+  "Wheter moves should take visual lines into account or not."
+  :type 'boolean
+  :group 'crux)
+
 (defun crux-ansi-term (buffer-name)
   "Use ansi-term for `crux-visit-term-buffer'"
   (ansi-term crux-shell buffer-name))
@@ -307,7 +313,11 @@ Deletes whitespace at join."
 (defun move-to-mode-line-start ()
   "Move to the beginning, skipping mode specific line start regex."
   (interactive)
-  (move-beginning-of-line nil)
+
+  (if crux-should-move-visually
+      (beginning-of-visual-line nil)
+    (move-beginning-of-line nil))
+
   (let ((line-start-regex (cdr (seq-find
                                 (lambda (e) (derived-mode-p (car e)))
                                 crux-line-start-regex-alist



reply via email to

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