I have 2 markers (created with copy-marker): b and e and I want to run occur for the string "foo" on the region between b and e. What's the correct syntax?

I tried:

(occur "foo" 1 '((b . e)))

because the help says:

Optional arg REGION, if non-nil, mean restrict search to the specified region. Otherwise search the entire buffer. REGION must be a list of (START . END) positions as returned by ‘region-bounds’.

but it doesn't work.

I also tried:

(occur "foo" 1 '(((point-min) . (point-max))))

to try to understand the syntax, but it doesn't work.

1 Answer 1


You are quoting too much and e.g. not giving a chance to point-min and point-max to evaluate anything - ditto for b and e in your first attempt.

Try (occur "foo" 1 (list (cons (point-min) (point-max)))) or (occur "foo" 1 (list (cons b e))) or use backticks and commas to allow the selective evaluation of subexpressions: (occur "foo" `((,(point-min) . ,(point-max)))) or (occur "foo" `((,b . ,e)))

Your Answer

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

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