- Subject: Re: [jed-users] inverse function of buffer_filename() ?
- From: jed@xxxxxxxxxxx (John E. Davis)
- Date: Tue, 27 May 2014 20:16:05 -0400
Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> wrote:
> I need the inverse function of buffer_filename(): obtain the buffer
> associated with a file.
Perhaps the following will meet your needs. If no matching buffer
exists, then it returns NULL. --John
define filename_buffer (file)
{
file = expand_filename (file); % convert to canonical form
variable buf_name, buf_file, buf_dir;
foreach buf_name ([buffer_list(), pop ()])
{
(buf_file, buf_dir,,) = getbuf_info (buf_name);
if (file == strcat (buf_dir, buf_file))
return buf_name;
}
return NULL;
}
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
[2014 date index]
[2014 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]