Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crux-smart-kill-line ignores visual-line-mode #99

Open
newhallroad opened this issue Nov 21, 2023 · 1 comment
Open

crux-smart-kill-line ignores visual-line-mode #99

newhallroad opened this issue Nov 21, 2023 · 1 comment

Comments

@newhallroad
Copy link

Thanks for a wonderful package.

When I run crux-smart-kill-line with the point at the end of the line, it kills the entire line.

With visual-line-mode activated and (setq crux-move-visually t) I would expect it to kill just the visual line.

crux-move-beginning-of-line works as expected, moving to the beginning of the visual line.

Using the following environment:
crux-20231013.520
Gnu emacs 29.1
Windows 10

@newhallroad
Copy link
Author

This is a suggestion for a replacement that takes visual lines into account.

(defun alk/crux-smart-kill-line ()
  "Kill to the end of the line and kill whole line on the next call. Takes visual line into account."
  (interactive)
  (let ((orig-point (point)))
    ;; If point at beginning of line, kill line from point to end of visual line
    (beginning-of-visual-line 1)
    (if (= orig-point (point))
        (kill-visual-line)
      ;; If point at end of line, kill line backward to beginning of visual line
      (end-of-visual-line 1)
      (if (= orig-point (point))
          (kill-visual-line 0)
        ;; If point in middle of line, kill line from point to end of visual line
        (goto-char orig-point)
        (kill-visual-line)))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant