Questions tagged [filenames]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
0answers
41 views

Is there a predefined way to detect if a file is a Unix socket?

Are there predefined Emacs functions to check if a file is a Unix socket? The best I could come up with is the following code. (defun socket-p (fname) "Return non-nil if FNAME is a Unix Socket, ...
0
votes
1answer
23 views

How to specify relative path to a file inside init.el

I have something like this inside my init file: (when (file-readable-p "/absolute/path/to/config.org") (org-babel-load-file (expand-file-name "/absolute/path/to/config.org")))...
0
votes
2answers
49 views

Elisp function to open file name with space?

To open a file with default associated application, I have this function, which works as I expect, except with a file name that has space: (defun open-a-file () (interactive) (let (...
1
vote
1answer
20 views

How to insert date into minibuffer, or how to create a new file with date as part of filename?

shell way: touch testfile-`date +%Y-%m-%d` emacs way? c-x c-f testfile-... now what? I want to type the first part of the filename myself, but not the date.
0
votes
0answers
31 views

How to define absolute directory paths and use them as file prefixes in org files

I need to represent absolute paths to several directories by some constant names to use them as prefixes in org mode for a number of files contained in each of these directories. For instance they ...
1
vote
2answers
35 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-...
2
votes
1answer
39 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
46 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 ...
2
votes
3answers
254 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 ...
1
vote
2answers
94 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 ...
3
votes
1answer
206 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 ...
1
vote
1answer
57 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
59 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 ...
0
votes
2answers
244 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 ...
1
vote
1answer
36 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 ...
2
votes
1answer
274 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-...
0
votes
0answers
29 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/...
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
42 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
42 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
0answers
137 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
203 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
0answers
211 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 ...
0
votes
1answer
138 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 ...
3
votes
2answers
283 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. ...
1
vote
1answer
215 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 ...
3
votes
2answers
167 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 ...
1
vote
1answer
52 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
71 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 ...
8
votes
1answer
457 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
130 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 ...
0
votes
1answer
302 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,...
2
votes
2answers
306 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 ...
1
vote
2answers
645 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 ...