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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:25:49+00:00 2026-05-25T20:25:49+00:00

Suppose I have a variable newName which is bearing some mode name, e.g. python-mode

  • 0

Suppose I have a variable newName which is bearing some mode name, e.g. "python-mode". How do I make current buffer of the mode specified by newName?

(progn
  (let (newName)
    (setq newName "python-mode")
    (newName) ;; doesn't work! It doesn't set current buffer's mode to be a python mode.
  )
)

This also doesn’t work:

(set-variable 'major-mode "python-mode")

This question is fundamental – since it is equal to “is it really possible to treat data as code in lisp?”

Edit

@phils

Your solution doesn’t work for me. I copy a buffer – and I want the new one to have the same mode as the old one. So I store the mode of the original buffer in the variable. Then try to apply Your solution. It gives error (it’s the essence – I omit here the buffer-copying stuff):

(let (sameMode)
  (setq sameMode major-mode)
  (funcall (intern sameMode))
)

sameMode stores here mode in the form of “python-mode” (example for python-mode).

  • 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-25T20:25:50+00:00Added an answer on May 25, 2026 at 8:25 pm
    (let ((mode "python-mode"))
      (funcall (intern mode)))
    

    or

    (let ((mode 'python-mode))
      (funcall mode))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a class Foo , with a private variable bar_ containing some
Let's suppose I have n arrays, where n is a variable (some number greater
Suppose I have variable x in bash. How can I test if it's some
Suppose we have a variable k which is equal 7: int k=7; int t=&k;
Suppose I have a class Base which has a member variable A* my_hash. I
suppose i have a variable int a=512 Now when i apply ~a which means
Suppose I have any variable, which is defined as follows: var a = function()
Suppose I have a variable of type Int = 08, how can I convert
Suppose i have a LPSTR variable. How do i free the memory after using
Suppose I have a static variable declared inside a function in C. If I

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.