help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on frame title


From: Random832
Subject: Re: Question on frame title
Date: Thu, 15 Oct 2015 13:30:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Benny Sum <benny.sum@gmail.com> writes:

> ls is just as an example.  I want to do unix command to get the
> revision control of a file.  Ultimately, here is what I want to do:
>
> Say unix command:
>> info_data filename
> -> revision number of the file from the database
>
> (setq frame-title-format
>  (list (format "%s" (shell-command-to-string(concat "info-data " " %b "))))) 
>
> So, I just use ls -1 as an example of unix command.
>
> But the problem is that it seems I don't have filename correctly.  It
> says I can't access the filename.  Did you try the command and see if
> that works for you?

I think you can do this with an :eval like this:

I included the default frame-title-format and put your info_data command
after it, since it won't work on non-files.

(setq frame-title-format
      '(""
        (multiple-frames "%b" ("" invocation-name "@" system-name))
        " "
        (:eval (when (stringp (buffer-file-name))
                 (shell-command-to-string
                   (concat "info_data "
                           (shell-quote-argument (buffer-file-name))))))))

This will re-execute the info-data command every time you switch
buffers. If the command is expensive, you may want to store the value in
a buffer-local variable.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]