[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Counting bracketing marks
From: |
fatiparty |
Subject: |
Re: Counting bracketing marks |
Date: |
Thu, 17 Mar 2022 04:39:20 +0100 (CET) |
Mar 17, 2022, 00:31 by help-gnu-emacs@gnu.org:
> Mar 16, 2022, 19:48 by help-gnu-emacs@gnu.org:
>
>> I want to count the number of opening and closing marks `(` and `)` .
>>
>> (defun bracketing-count (region-start region-end)
>> "Count opening and closing bracketing marks."
>> (interactive "r")
>>
>> (save-excursion
>> (let ( count (count-matches "\(" (point) region-end) )
>> (message "%d" count) )))
>>
> But this is giving me
>
> save-excursion: let' bindings can have only one value-form: count-matches,
> "(", (point), region-end user-error: Minibuffer window is not active`.
>
Figured out that I needed to enclose the count variable within parentheses.
(let ( (count (count-matches "\(" (point) region-end)) )
But with this change, I get a count of zero (0) on the following line
(global-set-key (kbd "[") 'skeleton-pair-insert-maybe)
- Counting bracketing marks, fatiparty, 2022/03/16
- Message not available
- Message not available
- Re: Counting bracketing marks,
fatiparty <=