Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6071313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:01:58+00:00 2026-05-23T10:01:58+00:00

Is there an emacs command to pad a justified string with a character? Specifically,

  • 0

Is there an emacs command to pad a justified string with a character? Specifically, I’d like to be able to take

;; Foobar

and get

;; ===================================Foobar====================================

where Foobar is centered in a field of width 77. For clarity, I produced the output above via the python code ";; {:=^77}".format("Foobar").

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:01:59+00:00Added an answer on May 23, 2026 at 10:01 am

    I don’t know of any existing function to do that, but it’s easy to write one:

    (defun center-string-in-char (str len char)
      (store-substring (make-string len char) (/ (- len (length str)) 2) str))
    

    Now (center-string-in-char "Foobar" 77 ?=) produces your example string (minus the leading ";; " which you can add yourself).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a substitute in emacs for the vi gf command? I mean to
Is there any themes for emacs which looks like this one? http://www.lnbogen.com/VisualStudioNet2005Colors.aspx
In emacs, is there a way to get hideshow-mode to recognize multiple regular expressions
I'd like to write a little emacs command to send an email. What's the
I get used to emacsclient for the speedy response like vim, by putting emacs
I would like to use the ispell-buffer command in Emacs. It uses the English
In GNU Emacs, is there a good way to change the comment-region command in
I would like to be able to navigate by sentence in Emacs (M-a, M-e).
Is there a way to change the text of the command line in emacs?
Is there a command line shell or shell customization that supports emacs-style ido find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.