Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

`last-command' exposes implementation of the package #4

Open
fehmud opened this issue Oct 26, 2014 · 4 comments
Open

`last-command' exposes implementation of the package #4

fehmud opened this issue Oct 26, 2014 · 4 comments

Comments

@fehmud
Copy link

fehmud commented Oct 26, 2014

Hello,

thanks for sharing this useful package.

There is a problem with the value of last-command after having executed any command from this package. The value of last-command will be the internal iy-go-to-char--command instead of iy-go-to-char or any other command from the interface of the package. This is a problem when writing a new command that builds on this package.

Thanks for your attention.

@doitian
Copy link
Owner

doitian commented Oct 27, 2014

It is tricky to support multiple cursor. I'll check to see how to work around it.

@doitian doitian added the ready label Oct 27, 2014
@fehmud
Copy link
Author

fehmud commented Oct 27, 2014

Thanks for your quick reply.

I am not an Emacs Lisp expert, but maybe you could set this-command before returning from each command. For instance, for iy-go-to-char we would have:

(defun iy-go-to-char (n char)
     ;; Implementation of `iy-go-to-char`
     (setq this-command 'iy-go-to-char))

@doitian
Copy link
Owner

doitian commented Oct 29, 2014

Do you have any plan to build a command based on this package? I don't see any benefit of it. This package is intended to be used by end user, instead of used as a library.

What you suggest is just the default behaviour of emacs. The problem is that when multiple cursor is enabled, iy-go-to-char will prompt you the char to search in every cursors.

@doitian doitian removed the ready label Oct 29, 2014
@fehmud
Copy link
Author

fehmud commented Oct 29, 2014

Thanks for your assistance.

I have already adapted two custom commands to use this package, namely my own "smart" commands that I have bound to C-w and M-w. To accomplish this, I had already disabled the temporary map (before the version 3.2.2 of the package allowed it).

I have never used Multiple Cursor, so I don't know what to say regarding interactions with that package. Maybe this package could rely on a buffer-local variable instead of last-command?

Anyway, tampering with last-command seems wrong. Even a package that is intended to be used by end users shouldn't leak its implementation. You never know what users could decide to do with a package. At least, the README should mention this quirk.

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

No branches or pull requests

2 participants