bug#50236: 27.2; electric-pair-mode is inconvenient in comint
João Távora <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Ihor Radchenko <[email protected]> writes: > João Távora <[email protected]> writes: > >> Ihor Radchenko <[email protected]> writes: >>> Paragraphs was just an example. My point is - major mode needs to decide >>> such things. And fields often serve different purposes, so, IMHO, they >>> are not the best vehicle to decide about bracket balancing. >> >> What purposes do fields often serve? I've seen them in comint-based >> shells, widgets, etc. They don't "decide" about bracket in the same way >> that don't don't "decide" about movement. This is just about isolating >> operation of certain features (delimiter balancing, movement, etc) to a >> given region. The uses I've seen of fields all match perfectly. > > IMHO, fields are more suitable to mark short spans of the text within > limited region in buffer. (e.g. tables). > >> If you'd rather make a complicated setting of electric-pair-skip-self >> and electric-pair-inhibit-predicate etc in your major mode (like c-mode >> infamously did and c-ts-mode fortunately didn't), you can. I just >> happen to think that setting a continugous 'field' property in your text >> source blocks is a nice thing to do for your users. But I don't use >> much org. > > In Org's case, we would need to fill the whole buffer with > fields. I'm not suggesting you delimit your buffer into paragraphs/headings. But _if_ you wanted to do that, you'd be wrong. You wouldn't need to "fill the whole buffer with field [properties]". A field is just a region of text with the same ‘field’ property, so if you set a single char's worth of "field=blargh" in the '*' (where you already set an overlay anyway aparently) you have the needed demarcations. Delete that heading and you magically merge the two fields for free. Play around with field-beginning and field-end to see what I mean. These functions are in C and they are pretty fast. > (Here, we do not care about previous section brackets) Not necessarily. Currently org matches across different headings and I haven't seen anyone complaining. Personally, it's only inside code blocks I think it makes a little more sense to track balance independently. > #+begin_src emacs-lisp > (message "And here we can Elisp code, that should be isolated") > #+end_src Only here would I do the courtesy of marking that a field, because it comes from another language completely. You already set a 'src-block' to 't' property there. I'd put a 'field' as well, and call it a day. It's probably a sub-1-loc patch which I would show if I somehow dared to navigate that petaline code base, but surely you can. João