jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

Check if transient-mark-mode is on #814

Closed snan closed 7 months ago

snan commented 7 months ago

This doesn't make sense for all commands like header insertion, so I only implemented it for some commands. Some of them said in the documentation that they check if transient-mark-mode was on which they didn't seem to do but they do with this commit. This is the way vertico and a couple of other packages use (use-region-p) in a more legacy-friendly way.

snan commented 7 months ago

This replaces #812 and #813 without introducing a new option

syohex commented 7 months ago

This is not correct because the region might not be defined when transient-mark-mode is nil. Then region functions such as region-beginning, region-end throw an error.

I have read lots of elisp code but they use use-region-p and don't care not transient-mark-mode case. You gave vertico as an example, but it doesn't use region functions around checking not transient-mark-mode.

I suppose you should do one of the followings

Or please fork this repository and improve it as you like, if you seriously need this feature,