From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B.V. Raghav" Newsgroups: gmane.emacs.help Subject: Re: Icicles for filename insertion in buffer Date: Fri, 29 Jan 2016 01:19:50 +0530 Organization: Indian Institute of Technology, Kanpur Message-ID: <8737thxz4x.fsf@ram.bvr.dp.lan> References: <87zivp1pwl.fsf@ram.bvr.dp.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454010628 10754 80.91.229.3 (28 Jan 2016 19:50:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Jan 2016 19:50:28 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 28 20:50:23 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aOsaC-0006OI-MN for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Jan 2016 20:50:20 +0100 Original-Received: from localhost ([::1]:58352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOsaB-0002W1-VZ for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Jan 2016 14:50:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOsa1-0002Vv-HK for help-gnu-emacs@gnu.org; Thu, 28 Jan 2016 14:50:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOsZx-0005fb-E0 for help-gnu-emacs@gnu.org; Thu, 28 Jan 2016 14:50:09 -0500 Original-Received: from mail2.iitk.ac.in ([202.3.77.186]:58542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOsZw-0005X2-Te for help-gnu-emacs@gnu.org; Thu, 28 Jan 2016 14:50:05 -0500 Original-Received: from smtp.cc.iitk.ac.in (smtp.cc.iitk.ac.in [172.31.1.22]) by mail2.iitk.ac.in (Postfix) with ESMTP id DD23C10001CF; Fri, 29 Jan 2016 01:19:50 +0530 (IST) Original-Received: from ram.bvr.dp.lan.iitk.ac.in (unknown [172.20.241.100]) (Authenticated sender: bvraghav) by smtp.cc.iitk.ac.in (Postfix) with ESMTPA id E474448; Fri, 29 Jan 2016 01:19:50 +0530 (IST) In-Reply-To: (Drew Adams's message of "Thu, 28 Jan 2016 11:28:30 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 202.3.77.186 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108900 Archived-At: Drew Adams 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)