all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Counting bracketing marks
@ 2022-03-16 19:48 fatiparty--- via Users list for the GNU Emacs text editor
       [not found] ` <MyJGX-H--3-2@tutanota.com-MyJGbbw--3-2>
  0 siblings, 1 reply; 3+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-03-16 19:48 UTC (permalink / raw)
  To: Help Gnu Emacs

I want to count the number of opening and closing marks that `(` 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) )))




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Counting bracketing marks
       [not found] ` <MyJGX-H--3-2@tutanota.com-MyJGbbw--3-2>
@ 2022-03-17  0:31   ` fatiparty--- via Users list for the GNU Emacs text editor
       [not found]   ` <MyKHHU1--3-2@tutanota.com-MyKHRPx----2>
  1 sibling, 0 replies; 3+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-03-17  0:31 UTC (permalink / raw)
  To: Fatiparty; +Cc: Help Gnu Emacs

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`. 







^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Counting bracketing marks
       [not found]   ` <MyKHHU1--3-2@tutanota.com-MyKHRPx----2>
@ 2022-03-17  3:39     ` fatiparty--- via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 3+ messages in thread
From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-03-17  3:39 UTC (permalink / raw)
  To: Fatiparty; +Cc: Help Gnu Emacs


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)

  




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-17  3:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-16 19:48 Counting bracketing marks fatiparty--- via Users list for the GNU Emacs text editor
     [not found] ` <MyJGX-H--3-2@tutanota.com-MyJGbbw--3-2>
2022-03-17  0:31   ` fatiparty--- via Users list for the GNU Emacs text editor
     [not found]   ` <MyKHHU1--3-2@tutanota.com-MyKHRPx----2>
2022-03-17  3:39     ` fatiparty--- via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.