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

meow-line support negative argument #564

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions meow-command.el
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
(meow--with-selection-fallback
(cond
((equal '(expand . join) (meow--selection-type))
(delete-indentation nil (region-beginning) (region-end)))

Check warning on line 259 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

delete-indentation called with 3 arguments, but accepts only 0-1
(t
(meow--prepare-region-for-kill)
(meow--execute-kbd-macro meow--kbd-kill-region)))))))
Expand All @@ -271,7 +271,7 @@
(meow--with-selection-fallback
(cond
((equal '(expand . join) (meow--selection-type))
(delete-indentation nil (region-beginning) (region-end)))

Check warning on line 274 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

delete-indentation called with 3 arguments, but accepts only 0-1
(t
(meow--prepare-region-for-kill)
(let ((s (buffer-substring-no-properties (region-beginning) (region-end))))
Expand Down Expand Up @@ -937,23 +937,38 @@
(unless (or expand (equal '(expand . line) (meow--selection-type)))
(meow--cancel-selection))
(let* ((orig (mark t))
(n (if (meow--direction-backward-p)
(- n)
n))
(forward (> n 0)))
(backward (meow--direction-backward-p))
(forward (> n 0))
cnt p)
(cond
((region-active-p)
(let (p)
(save-mark-and-excursion
(forward-line n)
(goto-char
(if forward
(setq p (line-end-position))
(setq p (line-beginning-position)))))
(thread-first
(meow--make-selection '(expand . line) orig p expand)
(meow--select))
(meow--maybe-highlight-num-positions '(meow--backward-line-1 . meow--forward-line-1))))
(setq cnt (count-lines (region-beginning) (region-end)))
(save-mark-and-excursion
(cond
(backward
(cond
((> (+ cnt n) 0)
(forward-line (- n))
(setq p (line-beginning-position)))
(t
(goto-char orig)
(setq orig (line-beginning-position))
(forward-line (- (+ cnt n)))
(setq p (line-end-position)))))
(t ;; forward
(cond
((> (+ cnt n) 0)
(forward-line n)
(setq p (line-end-position)))
(t
(goto-char orig)
(setq orig (line-end-position))
(forward-line (- (+ cnt n)))
(setq p (line-beginning-position)))))))
(thread-first
(meow--make-selection '(expand . line) orig p expand)
(meow--select))
(meow--maybe-highlight-num-positions '(meow--backward-line-1 . meow--forward-line-1)))
(t
(let ((m (if forward
(line-beginning-position)
Expand Down Expand Up @@ -1314,7 +1329,7 @@
;;; VISIT and SEARCH
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun meow-search (arg)

Check warning on line 1332 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

docstring wider than 80 characters
" Search and select with the car of current `regexp-search-ring'.

If the contents of selection doesn't match the regexp, will push it to `regexp-search-ring' before searching.
Expand Down Expand Up @@ -1377,7 +1392,7 @@
(or (funcall func text nil t 1)
(funcall func-2 text nil t 1)))))

(defun meow-visit (arg)

Check warning on line 1395 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

docstring wider than 80 characters
"Read a string from minibuffer, then find and select it.

The input will be pushed into `regexp-search-ring'. So
Expand Down Expand Up @@ -1779,8 +1794,8 @@
(cmd (key-binding key)))
(if-let ((dispatch (and (commandp cmd)
(get cmd 'meow-dispatch))))
(describe-key (kbd dispatch) buffer up-event)

Check warning on line 1797 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

describe-key called with 3 arguments, but accepts only 1-2

Check warning on line 1797 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

describe-key called with 3 arguments, but accepts only 1-2
(describe-key key-list buffer up-event)))

Check warning on line 1798 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

describe-key called with 3 arguments, but accepts only 1-2

Check warning on line 1798 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

describe-key called with 3 arguments, but accepts only 1-2

Check warning on line 1798 in meow-command.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

describe-key called with 3 arguments, but accepts only 1-2
;; for mouse events
(describe-key key-list buffer up-event)))

Expand Down Expand Up @@ -1811,3 +1826,3 @@

(provide 'meow-command)
;;; meow-command.el ends here
Loading