[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Icicles for filename insertion in buffer
From: |
B.V. Raghav |
Subject: |
Re: Icicles for filename insertion in buffer |
Date: |
Fri, 29 Jan 2016 01:19:50 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Drew Adams <drew.adams@oracle.com> writes:
>
> Your #1, #2, and #3 do not seem to be about Icicles. And I don't
Sorry that I assumed a bit too much. I meant how can I make use of
Icicles to create a function like this:
> know what function `insert-file-name-relative-include-directories' is.
That inserts at point the part of file-name selected by icicles(? is that the
correct grammar?) relative to the given include path.
Again apologies for being unclear.
> [I take it that you are not talking about insertion, into the minibuffer,
You are correct here. I am not talking about M-. (and ThingAtPoint+)
I tried my hand at elisp, and discovered the function `read-file-name'
that does invoke icicles. And voila, the following snippet covers most
of my use-cases.
(let ((hpp-file-name (read-file-name "Header File: " "/usr/include/")))
(let ((pos (string-match "/usr/include/" hpp-file-name)))
(if (not (eq nil pos))
(substring hpp-file-name (+ pos (length "/usr/include/")))
(let ((pos (string-match "/inc/" hpp-file-name)))
(if (not (eq nil pos))
(substring hpp-file-name (+ pos (length "/inc/"))))
))))
I use this with yasnippet, and I am good to go.
That said, I am clueless about how to insert relative filenames, like:
# include "impl/SomeHeaderImpl.hpp"
or,
# include "../RelativeHeader.hpp"
Thanks,
r
--
(B.V. Raghav)