1

I have mark-even-if-inactive set to t in my init.el; I've found that I that so (interative "r") works as expected; if that variable is nil, I get "The mark is not active now" when I try to run my interactive commands.

I can use Customize to set that variable -- but I'm also using Hyperbole, and when hyperbole-mode is loaded, it explicitly sets that variable to nil:

(defun hyperbole--enable-mode ()
  "Enable Hyperbole global minor mode."
  ;; Store the current value and set `mark-even-if-inactive' to nil so
  ;; can select delimited things if the region is not active when
  ;; hyperbole-mode is enabled.
  (setq hyperbole--mark-even-if-inactive mark-even-if-inactive
    mark-even-if-inactive nil)
; etc etc

When I later manually set mark-even-if-inactive to t, things seem fine, so I'd like to override that behavior of hyperbole--enable-mode. What's a good way to do that?

5
  • Your question isn't clear. Do you just want to reenable the setting after enabling hyperbole mode? If so, it sounds like Hyperbole likely won't work (it's a global minor mode, apparently). Or do you want to make your commands work as if that var were non-nil, even though Hyperbole mode is enabled (and so the variable is nil)? Just what is it that you want to do?
    – Drew
    Commented Jun 3, 2022 at 21:27
  • You can always edit the function (i.e. fork Hyperbole) and eliminate the setting. I have no idea what that will do to Hyperbole however.
    – NickD
    Commented Jun 4, 2022 at 1:23
  • I want to reenable the setting after enabling hyperbole mode. I'm sure they had some good reason for doing that, but I haven't observed any problems, and am willing to suffer the consequences. :) @NickD, yes, I can edit hyperbole.el, but I'm curious to know if there's a more elegant or idiomatic way.
    – Dan Drake
    Commented Jun 5, 2022 at 21:34
  • If you don't want to fork Hyperbole, then I would guess (I haven't actually tried it out) the simplest way is to undo the setting in the hyperbole-mode-hook. That would avoid the need to fork Hyperbole, but whether it's elegant or not is in the eye of the beholder. Personally, I would rather fork Hyperbole, but that's just me. The best way however might be to ask the question in the upstream Hyperbole repo (assuming that there is one somewhere): if it gets changed there, then you don't have to worry about it ever again.
    – NickD
    Commented Jun 5, 2022 at 23:50
  • Thanks, that's what I was looking for. I posted your suggestion as the answer. I'll also look into posting an issue on the Hyperbole repo.
    – Dan Drake
    Commented Jun 6, 2022 at 16:20

1 Answer 1

1

As @NickD points out, probably one of the most idiomatic ways to do this is to use a mode hook, in particular hyperbole-mode-hook.

I added this to my initialization:

(add-hook 'hyperbole-mode-hook (lambda () (setq mark-even-if-inactive t)))

and that works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.