[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ExecuteMetaData with [ ] instead of { }
From: |
Arash Esbati |
Subject: |
Re: ExecuteMetaData with [ ] instead of { } |
Date: |
Wed, 24 Aug 2022 09:36:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
Uwe Brauer <oub@mat.ucm.es> writes:
> Well
>
> (defun my-catch-counter-inc ()
> "Increment `my-catch-counter' and return the new value."
> (when (= my-catch-counter 0)
> (save-excursion
> (goto-char (point-min))
> (while (re-search-forward (concat "^\\%<\\*\\(" my-catch-chars
> "*?\\)>$")
Wouldn't it be easier to write the regexp above like this:
"%<\\*\\([^>]+\\)>$"
> (point-max) t)
> (let ((fn (string-to-number (match-string 1))))
> (when (> fn my-catch-counter)
> (setq my-catch-counter fn))))))
> (setq my-catch-counter (1+my-catch-counter)))
^
Does this version throws an error? There is a space missing after `1+':
,----[ C-h f 1+ RET ]
| 1+ is a built-in function in ‘C source code’.
|
| (1+ NUMBER)
|
| Return NUMBER plus one. NUMBER may be a number or a marker.
| Markers are converted to integers.
|
| Other relevant functions are documented in the number group.
| Probably introduced at or before Emacs version 1.12.
| This function does not change global state, including the match
| data.
| This function has a ‘byte-compile’ property ‘byte-compile-one-arg’.
| See the manual for details.
|
`----
This works:
(let ((my-catch-counter 0))
(setq my-catch-counter (1+ my-catch-counter))
my-catch-counter)
Best, Arash
- Re: ExecuteMetaData with [ ] instead of { }, (continued)
- Re: ExecuteMetaData with [ ] instead of { }, Arash Esbati, 2022/08/18
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/18
- Re: ExecuteMetaData with [ ] instead of { }, Arash Esbati, 2022/08/18
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/18
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/19
- Re: ExecuteMetaData with [ ] instead of { }, Arash Esbati, 2022/08/23
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/23
- Re: ExecuteMetaData with [ ] instead of { }, Arash Esbati, 2022/08/23
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/23
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/23
- Re: ExecuteMetaData with [ ] instead of { },
Arash Esbati <=
- Re: ExecuteMetaData with [ ] instead of { }, Uwe Brauer, 2022/08/24