This is a simple logic test that makes use of down-list
and asks if another nested pair of parenthesis exits or not.
(not (eql (point)
(progn (ignore-errors (down-list))
(point))))
A weird thing occurred when this is re-written as a function that accepts another function as argument.
(defun next-pair-exists-in (func)
"Check if inner or outer pair exists.
Function employs `(up-list)` or `(down-list)` as argument to work."
(not (eql (point)
(progn (ignore-errors (func))
(point)))))
While the eql
point test code returns t
for positions to the left of 1, 2 and 3, the function, while moving the cursor inwards as expected, returns nil
for all positions.
(1(2(3)4)5)
How do we get the function to work?