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 7647495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:28:35+00:00 2026-05-31T10:28:35+00:00

I have a confession: I don’t know Lisp. Despite that fact, with a bit

  • 0

I have a confession: I don’t know Lisp. Despite that fact, with a bit of help from some co-workers, I managed to write an emacs macro/script which:

  1. switched to shell mode (ie. M-x shell-mode)
  2. disabled truncating lines (ie. M-x toggle-truncate-lines)
  3. started a database console (ie. “mysql”)

I was then able to start emacs with that macro using the –script option, and suddenly I had a way to start mysql in a much friendlier environment with a single command 🙂

But here’s the problem: I changed jobs and left that script behind. Now I’d very much like to re-create that script at my new job, but I no longer have any emacs experts to help me write it like I did at the old job.

Now, I really hate SO posts where someone basically says “please write my code for me”, so I don’t want to do that. However, if any emacs macro experts could at least give me some pointers (like “here’s how you invoke a M-x command in a macro”), or point me to an emacs-macro-writing guide, or otherwise “teach me to fish” on this issue, I would greatly appreciate it.

… and if someone just happened to have a similar script already lying around that they wanted to post, I certainly wouldn’t complain 😉

  • 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-31T10:28:37+00:00Added an answer on May 31, 2026 at 10:28 am

    Most emacs commands (i.e., M-x toggle-truncate-lines) can be translated directly to elisp by wrapping them in parentheses:

    (toggle-truncate-lines)
    

    The rumours are true, in lisp you just scatter parentheses around and they make magic.

    Now in this case, you can do better. Toggling makes sense for an interactive function, but in a program you don’t really want to toggle truncate-lines, you want to turn on truncate-lines. Its the same thing if truncate-lines was turned off to begin with, but you don’t know when your program will be run next. Anyways, in Emacs, features are often controlled by a variable. In this case, the variable is truncate-lines, and to turn that feature on, you set the variable to t (which means true).

    To do this, use:

    (setq truncate-lines t)
    

    We use setq instead of = for assignment, because they made lisp before = had been invented.

    For the real scoop you should take a look at Robert Chassel’s excellent “An introduction to to Programming in Emacs Lisp”. It comes built-in with your emacs, you can get to it with C-h i m Emacs Lisp Intro.

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

Sidebar

Related Questions

I have some confusion with session handling in PHP. I know how to regenerate
I have some VB.NET (which I don't normally deal with) code which must be
I have very simple query. I want to make sure that I don't have
I have created an Android application that includes some unit conversion tools built into
I'm having trouble with this query. I have 2 date coming from textboxes (don't
Removed the C tag, seeing as that was causing some confusion (it shouldn't have
I have some confusion related to the .NET platform build options in Visual Studio
I am learning Hibernate from the tutorials on JBoss website. I have a confusion
I have to create a regular expression for some path conversion. Example for path
I have an object that I'm serializing that contains a lot of doubles and

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.