all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Enclosing text in a box
Date: Thu, 17 Nov 2022 09:43:00 +0300	[thread overview]
Message-ID: <Y3XX9POFHmP24NID@protected.localdomain> (raw)
In-Reply-To: <CUOlDx0wcKA7EcVhzcC7C0SR4NlxReCbOWEs3Wnic1rGUxgCQXrk_BIPgz3n6KGvFz0AfZ0976-ub1SdBjIYzjSDbn9DQc7waY5T6qN_xhc=@protonmail.com>

* Heime <heimeborgia@protonmail.com> [2022-11-16 15:49]:
> 
> Would like to enclose some text in a box?  The box has to automatically adjust its size
> according to the size of the text.
> 
>       (insert "╔══════╗\n")
>       (insert (concat "║" text "║\n" ))
>       (insert "╚══════╝" )

I did not read the rest of answers to your question.

Package is here:

Emacs Lisp: rcd-box.el package for table drawings:
https://hyperscope.link/7/3/9/8/1/Emacs-Lisp-rcd-box-el-package-for-table-drawings-73981.html

Basic function:

(rcd-box-table '(("My text"))) ⇒ "
╔═════════╗
║ My text ║
╚═════════╝

"

If you wish to make it simpler:

(defun rcd-box-text (text)
  (rcd-box-table (list (list text))))

(rcd-box-text "Hello") ⇒ "
╔═══════╗
║ Hello ║
╚═══════╝

"

;; Available box drawing types: DOUBLE, HEAVY, LIGHT

That means you can do:


(rcd-box-table '(("My text")) nil "center" "double") ⇒ "
╔═════════╗
║ My text ║
╚═════════╝

"

(rcd-box-table '(("My text")) nil "center" "heavy") ⇒ "
┏━━━━━━━━━┓
┃ My text ┃
┗━━━━━━━━━┛

"

(rcd-box-table '(("My text")) nil "center" "light") ⇒ "
┌─────────┐
│ My text │
└─────────┘

"

and then you can add it to simpler function like:

(defun rcd-box-text (text &optional type)
  (rcd-box-table (list (list text)) nil "center" type))

(rcd-box-text "And now good bye to all" "heavy") ⇒ "
┏━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ And now good bye to all ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━┛

"


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  parent reply	other threads:[~2022-11-17  6:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 12:47 Enclosing text in a box Heime
2022-11-16 13:07 ` Heime
2022-11-16 13:34   ` Alexis Roda
2022-11-16 13:58     ` Eli Zaretskii
2022-11-16 14:11       ` Yuri Khan
2022-11-16 14:20         ` Heime
2022-11-16 14:47         ` Eli Zaretskii
2022-11-16 14:51           ` Heime
2022-11-16 14:55             ` Emanuel Berg
2022-11-16 20:56               ` Emanuel Berg
2022-11-16 16:44             ` Eli Zaretskii
2022-11-16 16:48               ` Heime
2022-11-16 16:53                 ` Heime
2022-11-16 19:20                 ` Eli Zaretskii
2022-11-16 19:35                   ` Heime
2022-11-16 19:42                     ` Emanuel Berg
2022-11-16 21:01                       ` Heime
2022-11-16 20:00                     ` Eli Zaretskii
2022-11-16 20:55                       ` Emanuel Berg
2022-11-18 14:48                         ` Eli Zaretskii
2022-11-18 15:10                           ` tomas
2022-11-18 19:18                           ` Emanuel Berg
2022-11-16 21:04                       ` Emanuel Berg
2022-11-16 14:55           ` Yuri Khan
2022-11-16 15:06             ` Yuri Khan
2022-11-16 16:12               ` tomas
2022-11-16 16:43                 ` Heime
2022-11-17  6:43 ` Jean Louis [this message]
2022-11-17  6:57   ` Emanuel Berg
2022-11-18 19:11     ` Jean Louis
2022-11-21 12:53       ` Emanuel Berg
2022-11-18 16:20   ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3XX9POFHmP24NID@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.