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

  • Home
  • SEARCH
  • 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 9118895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:15:51+00:00 2026-06-17T05:15:51+00:00

Is there a way to execute emacs command on multiple buffers without having to

  • 0

Is there a way to execute emacs command on multiple buffers without having to selecting them individually and executing it on each individual buffer.

I usually open multiple files matching a particular regex, e.g. ~/*.py and wish to enable a particular mode, say hs-minor-mode or glasses-mode on each, or say execute C-c @ C-M-h on each. Currently I have to select each one of them and do it individually. So is there a hack or a loop to automate the task.

Lets say I mark the buffers from the buffer-list and then run the command for all those marked.

I tried this but after executing the commands in eval-expression I completely lost access to my minibuffer, meaning whenever I typed M-x the minibuffer returned this

unable to access the minibuffer emacs error “Process Menu Mode doesn’t support Hideshow Minor Mode”

and I was forced to actually kill the entire emacs process because the C-x C-s wasn’t working neither was the End Task.

PS: I have no experience in elisp

  • 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-06-17T05:15:52+00:00Added an answer on June 17, 2026 at 5:15 am

    You can use ibuffer mode for this (It is part of the default Emacs distribution).

    (global-set-key "\C-x\C-b" 'ibuffer) ;; make ibuffer the default
    

    In *Ibuffer* you can mark the required buffers with m and then
    execute a form in each with E.

    Generally, ibuffer is a lot more flexible then the usual buffer list and I think ibuffer should really be the default buffer-list in Emacs.

    If you do this often, you might want to switch those particular modes on every time you enter python mode by attaching them to the mode-hook:

    (add-hook 'python-mode-hook 'hs-minor-mode)
    (add-hook 'python-mode-hook 'glasses-mode)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to execute the command for a progid verb without having
Is there any way to execute perl code without having to use Runtime.getRuntime.exec(...); (parse
Is there any way to execute two bash scripts without the first one blocking?
is there any way to execute multiple statements (none of which will have to
Is there a way to execute the following command through C#? .\binary.exe < input
Is there a way to execute printscreen key of the keyboard from the command
Is there a way to execute a stored procedure that returns multiple result sets
Is there a way to execute Git commands against a repository without being in
Is there any way to execute Linux commands with c without using execlp() ,
Is there a way to execute grid.py without running gnuplot? I would rather not

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.