[Top][All Lists]

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

Re: "Why is emacs so square?"

From: Clément Pit-Claudel
Subject: Re: "Why is emacs so square?"
Date: Fri, 17 Apr 2020 15:31:53 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 17/04/2020 14.51, Eli Zaretskii wrote:
>> Date: Fri, 17 Apr 2020 21:36:27 +0300
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden
>> Did you try using an image?

I did not.  Interesting thought! But since I need the "[" on graphical 
terminals, I'd use a replacement spec that says to show an empty image on 
graphical terminals, is that right?

> Or a window-specific overlay?

Interesting! But wouldn't I need to re-create the overlays every time the 
buffer is displayed in a new window?

> And btw, in the conditional 'display' spec, did you call
> display-graphic-p with a frame argument?

Yes, here's the full test:

(defface my-button
  '((((type x w32 ns) (class color))
     :box (:line-width -1 :style released-button)
     :background "lightgrey" :foreground "black")
    (t :inherit underline))
  "Button face"
  :group 'flycheck-faces)

(with-current-buffer (get-buffer-create "button")
  (insert (propertize "[" 'display '(when (display-graphic-p (selected-frame)) 
. "")))
  (insert (propertize "button" 'face 'my-button))
  (insert (propertize "]" 'display '(when (display-graphic-p (selected-frame)) 
. ""))))

I put this code in button.el, then I run emacs like this:

  emacs -Q -nw -l button.el 

I display the buffer in the terminal; it looks like this: [button] with 
"button" underlined

Then I use M-x make-frame-on-display :0 to show the same buffer in a graphical 
frame.  I see this: [button] with a 3D face on "button".  If I move the point, 
the brackets disappear on both frames (the terminal one and the graphic one.  
If I switch back to the terminal frame, the brackets reappear on both frames.


reply via email to

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