[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enclosing text in a box
From: |
Eli Zaretskii |
Subject: |
Re: Enclosing text in a box |
Date: |
Fri, 18 Nov 2022 16:48:50 +0200 |
> From: Emanuel Berg <incal@dataswamp.org>
> Date: Wed, 16 Nov 2022 21:55:05 +0100
>
> Eli Zaretskii wrote:
>
> >> Asking users to handle such conditions would be too hard to
> >> do repeatedly.
> >
> > This is not userland, this is Emacs Lisp programming for
> > display, and yes, it is quite tricky
>
> (defun sign (label)
> (interactive "sLabel: ")
> (let*((vertical "|")
> (horizontal ?-)
> (corner "+")
> (mid (format "%s %s %s" vertical label vertical))
> (len (length mid))
> (top (format "%s%s%s" corner (make-string (- len 2) horizontal)
> corner))
> (sgn (format "%s\n%s\n%s\n" top mid top)) )
> (insert sgn) ))
>
> ;; M-x sign This is not a bluff RET
> ;;
> ;; +---------------------+
> ;; | This is not a bluff |
> ;; +---------------------+
And now try with "fullwidth" characters, like the below:
M-x sign RET This is not a bluff RET
This yields:
+---------------------+
| This is not a bluff |
+---------------------+
Hmm...
- Re: Enclosing text in a box, (continued)
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Eli Zaretskii, 2022/11/16
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Eli Zaretskii, 2022/11/16
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Eli Zaretskii, 2022/11/16
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Eli Zaretskii, 2022/11/16
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/18
- Re: Enclosing text in a box,
Eli Zaretskii <=
- Re: Enclosing text in a box, tomas, 2022/11/18
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/20
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/18
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/16
- Re: Enclosing text in a box, Heime, 2022/11/16
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/16
- Re: Enclosing text in a box, Emanuel Berg, 2022/11/18
- Re: Enclosing text in a box, Yuri Khan, 2022/11/16
- Re: Enclosing text in a box, Yuri Khan, 2022/11/16
- Re: Enclosing text in a box, tomas, 2022/11/16