dogears.el icon indicating copy to clipboard operation
dogears.el copied to clipboard

Ignore derived modes in dogears-ignore-modes

Open protesilaos opened this issue 3 years ago • 3 comments

Hello again Adam!

I noticed that dogears-ignore-modes does not exclude derived modes. So passing it something like fundamental-mode only excludes buffers whose major-mode is that.

A search for derived-mode-p yields no results. Is this by design? Because I feel that it is more difficult to exclude every single major-mode I do not want to track.

protesilaos avatar Sep 03 '21 12:09 protesilaos

Hi Prot,

I used derived-mode-p initially, but it seemed that too many modes derived from fundamental-mode to make it useful, so I switched to comparing mode symbols directly.

I guess we could add another variable listing modes that should be ignored if a buffer's mode is derived from one of those modes. What do you think?

alphapapa avatar Sep 04 '21 03:09 alphapapa

On 2021-09-03, 20:37 -0700, alphapapa @.***> wrote:

I used derived-mode-p initially, but it seemed that too many modes derived from fundamental-mode to make it useful, so I switched to comparing mode symbols directly.

Ah yes, that can be a problem.

I guess we could add another variable listing modes that should be ignored if a buffer's mode is derived from one of those modes. What do you think?

Such an option would work for me. Not sure if you like to have similar-looking options though. What happens if this one conflicts with the above-stated intention? Does this one take precedence?

Alternatively, how about a passlist? So enable dogears where specified. But that will probably require more changes...

Or maybe accept a regexp? I am hesitant to test some code, as I am not sure what the best approach is or how you would prefer to go about it. But this is what now comes to mind:

(setq my-test-regexp "\\(notmuch\\|elfeed\\)")

(cl-remove-if (lambda (mode)
                (string-match-p my-test-regexp (symbol-name mode)))
              '(notmuch-one notmuch-two elfeed-one elfeed-two fundamental-mode))

At any rate, I am fine with how things stand and don't mean to put extra work on you. Just wanted to make sure this was a design decision.

P.S. I already find dogears very helpful so thanks again for sharing!

-- Protesilaos Stavrou https://protesilaos.com

protesilaos avatar Sep 04 '21 04:09 protesilaos

I don't know what the best solution is, but it sounds like more options are needed. A regexp test against mode names should be simple enough; many things in Emacs do that already.

I don't think precedence would be a problem. Any of these ways to ignore a mode should cause it to be ignored.

alphapapa avatar Sep 04 '21 05:09 alphapapa