help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to deal with comment in a new lang mode


From: Andreas Politz
Subject: Re: how to deal with comment in a new lang mode
Date: Sat, 01 Nov 2008 16:24:48 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

Xah wrote:
On Nov 1, 6:47 am, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
Xah wrote:
...
(defun xlsl-uncomment-region (p1 p2)
  "Remove “//” in the beginning of each line of selected text."
  (interactive "r")
  (let ((deactivate-mark nil))
    (save-excursion
      (goto-char p2)
      (while (>= (point) p1)
        (xlsl-uncomment-current-line)
        (previous-line)
        )
      )
    )
  )
...

PS is there a command to compact the ending parens?

Kevin Rodgers wrote:
C-M-% ) C-q C-j SPC + ) RET )) RET

Rupert Swarbrick wrote:
Well, I tend to go to the last one and C-a C-\ <backspace>
repeatedly. Well in fact, it's usually
  C-x C-( C-a C-\ <backspace> C-x C-) C-x e e e e e .... e

ugh! I could have counted the parens, delete, then type them faster
than these methdos.

kinda interesting that almost 3 decades of emacs+elisp its still like
this.

i suppose i or any could easily write up a command to compact ending
parens ... i wonder why it's not really done. I guess its because most
people type parens one by one (as opposed to pairs), so they never
ends up with hanging parens like above in the first place.

  Xah
∑ http://xahlee.org/

I think your conclusion is true, but as for the proposition (people type
parens one by one), I think most people simply don't end up with this pattern
of parentheses when they code lisp. Where did the newline come from
anyway, especially since it is not desired ?

However, I would probablly use this baby :


,----[ C-h k M-^ ]
| M-^ runs the command delete-indentation
|   which is an interactive compiled Lisp function in `simple.el'.
| It is bound to M-^.
| (delete-indentation &optional ARG)
|
| Join this line to previous and fix up whitespace at join.
| If there is a fill prefix, delete it from the beginning of this line.
| With argument, join this line to following line.
`----


-ap


reply via email to

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