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

feat(commands): add meow-pop-or-unpop-to-mark #690

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 17 additions & 1 deletion meow-command.el
Original file line number Diff line number Diff line change
Expand Up @@ -1562,10 +1562,26 @@ To search backward, use \\[negative-argument]."
Before jump, a mark of current location will be created."
(interactive)
(meow--cancel-selection)
(unless (member last-command '(meow-pop-to-mark-command meow-unpop-to-mark-command))
(unless (member last-command '(meow-pop-to-mark-command meow-unpop-to-mark-command meow-pop-or-unpop-to-mark))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't meow-pop-to-mark-command and meow-unpop-to-mark-command non-existent commands? I noticed this when I wrote #679, but didn't change it beacuse I thought about making a new PR.

Copy link
Contributor Author

@45mg 45mg Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in e2ff708 by @DogLooksGood: did you mean to write meow-pop-to-mark and meow-unpop-to-mark, or was this just a typo?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to write meow-pop-to-mark and meow-unpop-to-mark, or was this just a typo?

Sorry, this was just to make an observation on something I thought could be an issue.

I'll open up a separate issue for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(issue opened for this: #697)

(setq mark-ring (append mark-ring (list (point-marker)))))
(pop-to-mark-command))

(defun meow-pop-or-unpop-to-mark (arg)
"Call `meow-pop-to-mark' or `meow-unpop-to-mark', depending on ARG.

With a negative prefix ARG, call `meow-unpop-to-mark'. Otherwise, call
`meow-pop-to-mark.'

See also `meow-pop-or-unpop-to-mark-repeat-unpop'."
(interactive "p")
(if (or (and meow-pop-or-unpop-to-mark-repeat-unpop
(eq last-command 'meow-unpop-to-mark))
(< arg 0))
(progn
(setq this-command 'meow-unpop-to-mark)
(meow-unpop-to-mark))
(meow-pop-to-mark)))

(defun meow-pop-to-global-mark ()
"Alternative command to `pop-global-mark'.

Expand Down
9 changes: 9 additions & 0 deletions meow-var.el
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ the `word', `symbol' and `sexp' things, respectively.")
:group 'meow
:type 'boolean)

(defcustom meow-pop-or-unpop-to-mark-repeat-unpop nil
"Non-nil means that calling `meow-pop-or-unpop-to-mark'
after calling it with a negative argument unpops the mark again.

This variable is meant to be similar to `set-mark-command-repeat-pop'."
:group 'meow
:type 'boolean)


(defcustom meow-keypad-describe-delay
0.5
"The delay in seconds before popup keybinding descriptions appear."
Expand Down
Loading