[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: paren-close-dwim: elisp function of a newbie; feedback welcome

From: Harry Putnam
Subject: Re: paren-close-dwim: elisp function of a newbie; feedback welcome
Date: Fri, 27 Sep 2013 17:30:49 -0400
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.0.92 (gnu/linux)

Davis Herring <address@hidden> writes:

>>> (defun paren-close-dwim ()
>>>   "Insert closing parenthesis from syntax table.
>>> Use a normal parenthesis if not inside any."
>>>   (interactive "*")
>>>   (insert (or (ignore-errors
>>>                 (save-excursion (backward-up-list)
>>>                                 (cdr (syntax-after (point)))))
>>>               ?\))))
>> I'm a total illiterate in elisp but the narrative so far sounds like a
>> this code might do something really useful.
>> Can someone describe briefly how this would work, maybe with a small
>> example, when repairing my own perl code?
> I'm not sure what you mean about "repairing ... code".  This command
> simply inserts ')', ']', or '}' (and perhaps '>' or so) to match the
> most recent unclosed ([{<.

It was actually a reference to something Florian said in OP:

Florian wrote:
>> .  .  .  .  .  .  .  .  .  .  .  .  For me this is much handier
>> than using paren-mode or auto-pair etc, especially when modifying
>> existing code."

In my mind that registered as `repairing code'.

> (If it is "really useful", know that it's not my idea; you just quoted
> my reimplementation of Florian's code.)

Thanks, yes, sorry... I actually meant to be replying to Florian's OP.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]