From: Kaushal Modi <kaushal.modi@gmail.com>
To: "Jorge A. Alfaro-Murillo" <jorge.alfaro-murillo@yale.edu>,
help-gnu-emacs@gnu.org
Subject: Re: fill comma separated list
Date: Thu, 02 Jun 2016 17:47:48 +0000 [thread overview]
Message-ID: <CAFyQvY1zsqQ2Bq31ySW2U7+ZLSDrEHmfO5NgQA6W0g0TodcnyA@mail.gmail.com> (raw)
In-Reply-To: <87r3cf8rx4.fsf@yale.edu>
On Thu, Jun 2, 2016 at 1:14 PM Jorge A. Alfaro-Murillo <
jorge.alfaro-murillo@yale.edu> wrote:
>
> Let's play emacs golf: (I assume no whitespace and cursor at the
> initial 5):
>
> F3 C-e <space> C-d C-e <space> C-d C-e <backspace> C-n C-a F4 C-0
> F4
>
> 14 key strokes.
>
http://i.imgur.com/dTdQRiG.gifv
Only the C-n key is not shown logged in the gif. But here is what I did
With cursor at the initial 5,
(1) F3
(2,3) M-4 M-^ (In fact, I have bound the functionality of C-u M-^ to C-j
[see below])
(4,5) M-4 M-^
(6) C-n
(7,8) M-0 F4 (you do not need to hit F4 and then do M-0 F4)
8 keys (10 keys, if adding the 2 spaces)
I count M-4/M-0 as single keystrokes as I use the Alt key, not Esc. That
should be OK? :)
=====
If interested, I bind C-j to below:
(defun modi/pull-up-line ()
"Join the following line onto the current one (analogous to `C-e', `C-d')
or
`C-u M-^' or `C-u M-x join-line'.
If the current line is a comment and the pulled-up line is also a comment,
remove the comment characters from that line."
(interactive)
(join-line -1)
;; If the current line is a comment
(when (nth 4 (syntax-ppss))
;; Remove the comment prefix chars from the pulled-up line if present
(save-excursion
;; Delete all comment-start and space characters
(while (looking-at (concat "\\s<" ; comment-start char as per syntax
table
"\\|" (substring comment-start 0 1) ;
first char of `comment-start'
"\\|" "\\s-")) ; extra spaces
(delete-forward-char 1))
(insert-char ? )))) ; insert space
--
--
Kaushal Modi
next prev parent reply other threads:[~2016-06-02 17:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 13:02 fill comma separated list papab
2016-05-19 13:12 ` Emanuel Berg
2016-06-02 16:08 ` Kaushal Modi
[not found] ` <mailman.702.1464883755.1216.help-gnu-emacs@gnu.org>
2016-06-02 17:11 ` Emanuel Berg
2016-06-02 16:41 ` Jorge A. Alfaro-Murillo
2016-06-02 17:47 ` Kaushal Modi [this message]
2016-06-02 18:36 ` Jorge A. Alfaro-Murillo
2016-06-02 18:50 ` Jorge A. Alfaro-Murillo
2016-06-02 19:06 ` Kaushal Modi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY1zsqQ2Bq31ySW2U7+ZLSDrEHmfO5NgQA6W0g0TodcnyA@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=jorge.alfaro-murillo@yale.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).