Questions tagged [filenames]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8
votes
1answer
446 views

How do I unexpand a file name?

Given ~/foo/bar, I can get /home/sds/foo/bar using expand-file-name. However, given /Users/sds/foo/bar, how do I get ~/foo/bar? Use case: I want to copy a file between computers and they have ...
3
votes
2answers
165 views

Why does thing-at-point not consider plus as a filename character?

Why does thing-at-point not consider + as a filename character? For example: (defun my-get-filename-at-point () (interactive) (message (thing-at-point 'filename t))) and consider the cursor ...
3
votes
1answer
182 views

How to map or iterate over a list of files and set the result to `org-agenda-files`?

looking for a little help with my function. I'm trying to create a loop-while that'll return a list of files back to org-agenda-files. It's just not working though and i keep getting errors. Any ideas ...
3
votes
2answers
267 views

How to test if absolute path is a root file/directory

Q:  How to test whether an absolute path is a root file/directory (e.g., at the first level of the hard drive)? I see a few possibilities depending upon whether the file is on Windows or Unix/Linux. ...
3
votes
2answers
117 views

Increment file name and create a new version of the file

Assume that I am working with a file whose name contains a unique version number for example myfile_03.tex or 03jhcjh.tex and so on. Currently I create a new version of the file by C-x C-w and ...
2
votes
2answers
294 views

file-truename and tramp

Is these a function that behaves like file-truename on local files, but does not add the /protocol:host: prefix on remote files? Currently if I run (file-truename "./file.ext") while in a remote ...
2
votes
3answers
206 views

How to duplicate a file in Dired?

Let's say I have the following file shown in Windows File Explorer: If I enter C-c C-v to copy and paste the file, the file is duplicated and automatically given a name: We can repeat this to get ...
2
votes
1answer
234 views

Rename org buffers to org's +TITLE instead of filename

I have hundreds of org files in a single directory that I use as a personal knowledge base and use deft to quickly find and open them. Each file is automatically named based on the current time (yyyy-...
2
votes
1answer
27 views

Modify the first element of the kill-ring

I have stored in my clipboard a path to an image, which I want to paste inside emacs. I would like to modify the path to change/postpone/prepone some stuff before yanking. Following my previous ...
2
votes
1answer
37 views

Abbreviate “/home/user/file” to “~/file” in formatted fields (frame-title-format, etc.)

I have Emacs display the full path of the file in my window title: (setq-default frame-title-format '("%f [%m] - Emacs")) And in my mode-line: (setq-default mode-line-buffer-identification ...
1
vote
1answer
70 views

File mode name with -mode suffix or not?

I am not sure when I should name file x-mode.el and when x.el. Note that because of established practice mode writer should put (provide 'x) or (provide x-mode) to the end of file and end-users load ...
1
vote
2answers
92 views

Macro definition

I'm in the process of "modularizing" my config file and ran into a problem involving elisp macros. Because of the way in which I'm defining my configuration modules, I ended up with a bunch ...
1
vote
1answer
50 views

How to get absolute file names, to use with `cd`?

I have this function: ;; needs work in case of spaces in filenames (cl-defun filename-from-buffer (&key get-ext get-abs) "Returns the absolute name, with or without extension, of the file ...
1
vote
1answer
51 views

string splitting (renaming files)

new user here. I am wondering- can somebody walk me through how to do the following: In a given directory I have files that look like this fluc_sk2_556.png even_sk2_922.png I would like, with ...
1
vote
1answer
48 views

Converting init file on Mac/Linux to Windows

I use a package called Deft that needs a directory to store and load files. To define this directory on Mac or GNU/Linux I use the following expression: (setq deft-directory "~/Dropbox/org") When ...
1
vote
1answer
54 views

How to tweak dired-create-empty-file to facilitate the easy creation of files

I currently have bound the command dired-create-empty-file to f7. Emacs then prompts me for a file name. When I press f7 I would like Emacs to automatically create an ORG file and automatically ...
1
vote
2answers
639 views

How to get completion to ignore filename extensions

It's possible to ask completion to not suggest files with particular file extensions, by: (setq completion-ignored-extensions (append completion-ignored-extensions (quote ...
1
vote
1answer
34 views

Help; how use Persistent Sets of Completion Candidates for search?

I want to use a set of files inside my directory ~/Dokumente to search for changes in title, content. So I saved such a set of file names persistently, using C-} during file-name completion with ...
1
vote
1answer
38 views

How do I set Icicles’s default sort order for filenames?

In general, Icicles sorts things in alphabetical order. However, something I can’t find has made it so filenames are sorted in descending alphabetical order (z, y, x … b, a). I can use C-M-, to ...
1
vote
1answer
40 views

Don't offer non-file-name as a file name in find-file

When opening a file with find-file, the default entry in the minibuffer is the current directory. If I press Down, I see the name of the current file (if the current buffer is visiting a file). ...
1
vote
1answer
198 views

Magit diff with --name-only?

I am browsing the differences between two branches of a repository via git diff --name-only branch1 branch2 I also use the --name-status option sometimes, since I may need to see what sort of ...
1
vote
2answers
29 views

Custom compilation command fails on Windows due to slashes in paths

when i type on "shell": c:\Users\TR\Desktop\emacs-27.2-x86_64\bin\GAMES\game3>love . works fine but when i put (defun insert-file-name () (interactive) (let ((compilation-ask-about-...
1
vote
0answers
136 views

Automatically loading a bibliography file depending on buffer filename

I use org-mode to write a paper, with RefTeX as minor-mode to insert quotations from a BibTeX (.bib) file. RefTeX needs to be told which .bib file to use. This is done by assigning a value to reftex-...
0
votes
2answers
197 views

How to match the nondirectory part of a filename with a regular expression?

Whats the correct way to match a filename from a full path using string-match-p. Say I want to check if the file is a git commit message COMMIT_EDITMSG or svn-commit.tmp or svn-commit.3.tmp to pass ...
0
votes
2answers
188 views

Org links file name encoding issue

Inspired by John Kitchin's presentation of org-links features in Org-mode 9, I tried to implement a simple functionality for "file" links. Since I am working on several machines, I wanted the link ...
0
votes
1answer
129 views

How to sort a list of files/directories by hierarchical depth?

I am working on implementing my own feature request -- http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31601 -- to give wdired the ability to handle a dired- buffer that contains an arbitrary list of ...
0
votes
1answer
298 views

Can I exclude .git/COMMIT_EDITMSG from file-name-history?

Is there a way to exclude .git/COMMIT_EDITMSG files from file-name-history? Now that I'm authoring commits with Magit, those commit message files are often the most recent entries in file-name-history,...
0
votes
0answers
54 views

Why is ispell-skip-region-alist's expression for matching addresses, filenames, and URLs commented out?

ispell.el contains: (defvar ispell-skip-region-alist `((ispell-words-keyword forward-line) ... ;; Matches e-mail addresses, file names, http addresses, etc. The ;; `-+' `_+' ...
0
votes
0answers
24 views

Dired move file with quotation

When I do dired-do-copy on a file with a quotation for example "test"f.txt, I get the following error when copying/moving file with quotation symbols Copy ‘/home/user/Music/"test"f.txt’ to ‘/media/...
0
votes
0answers
200 views

org-agenda column view: displaying abbreviated FILE property

I would like to display file names in my global TODO list in column view without directories and extensions. (setq org-columns-default-format "%TODO %FILE %ITEM") followed by C-catC-cC-xC-c leads to ...