[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: finding the hork point in ~/.emacs
From: |
Emanuel Berg |
Subject: |
Re: finding the hork point in ~/.emacs |
Date: |
Thu, 27 Aug 2020 07:06:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Drew Adams wrote:
>> ? `comment-dwim':
>>
>> If the region is active and ‘transient-mark-mode’
>> is on, call ‘comment-region’ (unless it only
>> consists of comments, in which case it calls
>> ‘uncomment-region’).
>
> Right: "unless it..."
>
> I want it to comment when I tell it to comment,
> including when it may already be commented - nested
> comment blocks. And I want it to uncomment when
> I tell it to uncomment. This particular DWIM
> doesn't do-what-I-want. (It may do-what-you-want.)
It already uses the functions you recommend.
What else do you think a DWIM comment function should
base its behavior on, if not if the region is or
isn't already comments?
> What the code says. Regardless of the columns
> of point and mark, their lines and the lines
> between them are commented, from bol.
Ah, I recognize this from somewhere else, namely
(defun sort-whole-lines (start end)
(interactive "r")
(save-excursion
(let ((s (progn (goto-char start) (line-beginning-position)))
(e (progn (goto-char end) (line-end-position))) )
(sort-lines nil s e) ))) ; [1]
With comments for some reason, I never felt the need
to do it. But it should make sense, because when do
you ever want to [un]comment say lines, a, b, and c,
and then HALF of line d?
[1] https://dataswamp.org/~incal/emacs-init/sort-my.el
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
Message not available
Re: finding the hork point in ~/.emacs, Emanuel Berg, 2020/08/26