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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:12:00+00:00 2026-06-15T21:12:00+00:00

Sometimes I edit files that have a certain suffix and files with same basename

  • 0

Sometimes I edit files that have a certain suffix and files with same basename but another suffix. Since the basenames are long and awkward I would like to reuse the existing filename to construct the other name.

What I do currently is:

C-x C-b (This shows me the Buffer List)

C-x o (Now I am in the Buffer List)

M-right M-left (At the beginning of the basename)

C-space M-right ... M-w (Copying the basename)

C-x o (Back where I came from)

…

There must be a more canonical way to do this! (I am not interested in a way that involves the definition of a command proper, I have too many of them already…)


Edit: actually, what I wanted is to do something with that very name, most often create or read a related file. @Trey Jackson’s C-x C-v is it!

  • 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-15T21:12:02+00:00Added an answer on June 15, 2026 at 9:12 pm

    Strictly speaking this command does what you want, even if you don’t want a command:

    (defun copy-base-filename-as-kill ()
      (interactive)
      (let ((filename (buffer-file-name)))
        (when filename
          (kill-new (file-name-nondirectory (file-name-sans-extension filename))))))
    

    But, if you’re really just using this name to do something else… perhaps a better solution is to make doing that something else easier.

    Try the command C-x C-v (aka M-x find-alternate-file) if what you want to do is create a new name based on the current name.

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

Sidebar

Related Questions

Using Sublime Text 2, I sometimes have to edit shell files that are executed
I often edit long files in vim that have blocks of code in multiple
I have installed some dot files in vim. The files that I edit now
I have three mp3 audio files that play fine in all browsers but play
I have an intranet page that uses #include to include other files such as
I create websites for people. I have given them the ability to edit certain
Is there any way to edit .manifest files with Dreamweaver (CS 6)? I have
I have been using metaprogramming quite a lot, but sometimes the combination of c
I have a php-script that uploads files to an ftp server from a location
I do have the problem that all my files are opened by default with

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.