From: bvraghav@iitk.ac.in (B.V. Raghav)
To: Drew Adams <drew.adams@oracle.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: C Headers completion candidates
Date: Mon, 18 Jul 2016 16:51:50 +0530 [thread overview]
Message-ID: <87vb03i435.fsf@ram.bvr.dp.lan> (raw)
In-Reply-To: <6cd1402c-d034-4d6f-a7e7-ef09677a680e@default> (Drew Adams's message of "Sun, 17 Jul 2016 22:17:32 -0700 (PDT)")
Drew Adams <drew.adams@oracle.com> writes:
> Vanilla Emacs considers parameter INITIAL-INPUT to be deprecated.
> Icicles does not. But even vanilla Emacs still respects it. IMO,
> it is up to _you_ to decide whether, for your context, it is more
> useful to use INITIAL-INPUT or DEF (or both).
>
> (`C-h f completing-read' in Icicle mode mentions this.)
>
> In Icicle mode you can also choose to insert the default value
> (DEF) if INITIAL-INPUT is nil. You use var `icicle-default-value'
> to control such behavior. This is a user option, but you can also
> bind it in code if you want.
I refactored `c-header' to accept an optional `initial' argument,
(defun c-header(&optional initial)
;; code.. code.. code..
(completing-read var1 var2 nil nil initial)
;; code.. code.. code..)
Then combined it with yasnippets, the following way:
# -*- mode: snippet -*-
# name : #include <...>
# key : inc
# binding: C-c C-c C-i
# --
#include <`(c-header yas/selected-text)`>
The key binding makes it simpler for me to fulfill the use-case.
Example:
(_ represents point and [] represents region)
| Description | On Display |
|------------------------------------+--------------|
| write vec | vec_ |
| mark (may be C-S-a) | [vec]_ |
| Invoke yasnippets with C-c C-c C-i | #include <_> |
On the minibuffer I can see the selected text following the prompt
-----------------
Header: vec_
All I require is a TAB (or S-TAB) with Icicles and I am good to go!
Thanks,
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
next prev parent reply other threads:[~2016-07-18 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 4:51 C Headers completion candidates B.V. Raghav
2016-07-14 13:02 ` Stefan Monnier
2016-07-14 14:27 ` Drew Adams
2016-07-17 8:40 ` B.V. Raghav
2016-07-17 15:02 ` Drew Adams
2016-07-18 3:07 ` B.V. Raghav
2016-07-18 5:17 ` Drew Adams
2016-07-18 11:21 ` B.V. Raghav [this message]
2016-07-18 14:17 ` Drew Adams
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vb03i435.fsf@ram.bvr.dp.lan \
--to=bvraghav@iitk.ac.in \
--cc=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.