emacs-devel
[Top][All Lists]
Advanced

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

Re: OSC control sequences in comint


From: Lars Ingebrigtsen
Subject: Re: OSC control sequences in comint
Date: Wed, 25 Aug 2021 12:32:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Augusto Stoffel <arstoffel@gmail.com> writes:

> All right, I have attached a patch.  Since a comint buffer is editable,
> I chose an unobtrusive but less convenient keymap to the hyperlink
> buttons, based on bug-reference.el: 'C-c RET' opens the links.

Thanks; applied to Emacs 28.  Seems to work great with "ls --hyperlink".  :-)

(I added a short entry to the Emacs manual.)

> Note that there's a call to
>
>     (autoload 'browse-url-button-open "browse-url.el")
>
> in the patch, which is probably not the best procedure.  Should that
> function be autoloaded in browse-url.el?

Yup; I've amended the patch to do that instead.

> Finally, in case anyone wants to test or play around, a handler for the
> OSC 1337 escape (for inline images) could look like this:
>
>     (defun comint-osc-1337-handler (_ text)
>       (when (string-match ":" text)
>         (insert-image
>          (create-image (base64-decode-string (substring text (match-end 0))) 
> nil t))))
>
> Then one can say
>
>     (add-hook 'comint-output-filter-functions 'comint-osc-process-output nil 
> t)
>     (push '("1337" . comint-osc-1337-handler) comint-osc-handlers)
>
> and use https://iterm2.com/utilities/imgcat to show (small...) images in
> the shell.
>
> However, I don't think it makes sense to provide this handler in Emacs
> itself, since it is rather nonstandard.

Hm...  well, if it becomes popular (or more standard), then we should
add it, because it sounds pretty cool.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

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