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

hide-lines-matching fails for emacs 27.1 #8

Open
glendeni opened this issue Feb 18, 2023 · 3 comments
Open

hide-lines-matching fails for emacs 27.1 #8

glendeni opened this issue Feb 18, 2023 · 3 comments

Comments

@glendeni
Copy link

In moving from Ubuntu 14.04 (emacs version 23.4.1) to Ubuntu 22.04 (emacs version 27.1), I find hide-lines fails (using the same .emacs file as before) for

(hide-lines-matching "^ *#[^ #A-Z0-9]")

with

'Wrong type argument: listp, t'

in function hide-lines-add-overlay`- apparently coming from the sequence

(member 'hl buffer-invisibility-spec)

Am over my head trying to debug this, so must simply report and hope someone more knowledgable
than I can fix this, since functionality very useful to me

@sje30
Copy link

sje30 commented Jul 28, 2023

I got the same problem with Emacs 29 pretest.

My fix was to change the following defun slightly

(defun hide-lines-add-overlay (start end)
  "Add an overlay from `START' to `END' in the current buffer.
Push the overlay onto the `hide-lines-invisible-areas' list"
  (unless (hide-lines-invisible-p start end)
    (let ((overlay (make-overlay start end)))
      (push overlay hide-lines-invisible-areas)
      (unless (and (listp buffer-invisibility-spec)
		   (member 'hl buffer-invisibility-spec))
	(add-to-invisibility-spec 'hl))
      (overlay-put overlay 'invisible 'hl))))

by adding the extra check that (list buffer-invisibility-spec) returns true. The problem from what I could see is that the variable starts off as t, rather than a list.

happy to send a PR if this is indeed the problem and right fix.

@glendeni
Copy link
Author

glendeni commented Oct 7, 2023

That fixes my problem (had been entering backtrace when trying to use hide-show)! Now hide-show works for me. Thanks! Dunno what PR is, assume that is report to fix problem, if so please do.

@sje30
Copy link

sje30 commented Oct 8, 2023

thanks. A PR is a pull-request to fix the code, and someone else I see already fixed it before I did. See #7

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

No branches or pull requests

2 participants