Skip to main content

Questions tagged [filenames]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

Link org-mode to external file with "[" or "]" in the path

I have a "file name.txt" file whose full path is "G:/path1/[TAG] path2/file name.txt" How do I write the link to the external file "file name.txt" in org-mode? If I use [[...
Paolo's user avatar
  • 21
0 votes
0 answers
41 views

Is there a way to configure Emacs to never use a leading ~ whenever it needs to show me a path name?

In almost every situation I come across (e.g. in *BufferList*, in the pre-populated argument prefix for find-file, etc., etc.), Emacs uses a leading ~ in the paths to any files or directories under my ...
kjo's user avatar
  • 3,257
0 votes
0 answers
12 views

A file I was using for org-capture has been renamed (*filename*.org -> *filename* (1).org, is this normal?

I wanted to rule out this being a feature of org-capture, maybe a result of manually editing the file or something? If anyone has any other suggestions as to what else could have caused it I would be ...
Sean's user avatar
  • 1
1 vote
1 answer
154 views

In DirEd, how can I copy the directory path of a filename?

I have this function (defun my/dired-copy-dirname-as-kill () "Copy the current directory into the kill ring." (interactive) (kill-new default-directory)) , but this only copies the ...
Jason Hunter's user avatar
1 vote
0 answers
33 views

Configure Emacs to Respect Windows File Attributes?

Is it possible to configure Emacs under Windows to respect the 'hidden' and 'system' NTFS file attributes for example by filtering out these files during selection of filename completion candidates in ...
StackExchanger's user avatar
0 votes
1 answer
61 views

Disable environment variable substitution with $ in find-file

When using find-file, list-directory and other commands, if one types a $ a minibuffer completion appears with a list of currently set environment variables. I have no idea where this is coded, the ...
Ojd2000's user avatar
1 vote
2 answers
62 views

What variable holds filenames specified on Emacs command line?

What variable can Emacs Lisp access, to know the filenames specified on the command line that was used to invoke this Emacs session? The general command-line-args contains the remaining command-line ...
bignose's user avatar
  • 639
0 votes
0 answers
80 views

How to automatically convert between remote and local file names?

I have /local/laptop/dir mounted in my Docker container at /container/path. In Emacs tramp terms, it is /docker:container-id:/container/path. This also comes up when the user ssh to a remote system ...
pedz's user avatar
  • 375
2 votes
1 answer
316 views

How can I construct a bash-safe filename from a string?

I want to generate very simple filenames from complex strings during a org-capture. For instance the string "Une idée nouvelle pour calculer $\\int_0^{\\infty} e^{-t^2} \\dd t$" Should be ...
B. Pillet's user avatar
2 votes
1 answer
26 views

How to resolve a form before use

I have a form variable which contains a list of file paths specified via functions: (defcustom my-files-form '(append (list (concat my-root ".emacs") (concat my-...
halloleo's user avatar
  • 1,345
0 votes
1 answer
27 views

Adding to a list when there is a match only

The following function replaces filenames and places the result in a list. Although the list gets filled, I do not want to add the filename when there is no match. How can I avoid sending non-...
Dilna's user avatar
  • 1
0 votes
1 answer
25 views

Change target directory and storing result in a list

How can I make a function that matches a target directory at point, changing the user name to another one? Example, with cursor on /home/peter/web/ergomax.org I want to change from peter to paul, ...
Dilna's user avatar
  • 1
0 votes
2 answers
73 views

How can I open corresponding pdf of a tex file?

This question is the continuation of an earlier discussion here How can I run additonal linux commands after compiling a latex file. I have a opened tex file called let's say filename.tex, which also ...
alper's user avatar
  • 1,390
0 votes
1 answer
21 views

read-file-name: input an non-existing file with a default name in ido

I'd like to ask to the user where to save a .png file, where I provide some defaults, like: (read-file-name "Picture name:" "/tmp" "mydefaultname.png") (ideally in a ...
tobiasBora's user avatar
1 vote
0 answers
79 views

How to fix the directory drive letter in eshell to run a NextJS project?

This bug is hard to describe, so I'll tell you how to recreate it. I'm on Windows 10, emacs 27.2, & node v16.13.0. Here are the steps: Open a default emacs (no init) with emacs -Q from powershell ...
bifurcation_is_nature's user avatar
0 votes
1 answer
20 views

How can I get the filename of the most recently modified PDF file in my temp directory?

I'd just like to get the filename of the most recently modified PDF file in my /tmp/ directory, using elisp. Is there a function for that?
Jonathan's user avatar
  • 597
2 votes
2 answers
206 views

Why does emacs recognize my wildcard with finding file but not with searching buffer?

In the linux terminal, i often use wildcards (*) as a shorter alternative to type in the whole file name: if the file is named foo-and-cats I just type in something like fo* in order to pull up the ...
thinksinbinary's user avatar
0 votes
1 answer
64 views

Problems saving files and creating directory

I have recently set-up a new Emacs on my OSx 10.15. Every time I try to create a directory in Dired with + I got a warning telling the files already exist. Another strange result I got when I try to ...
Enrico Pirani's user avatar
2 votes
0 answers
48 views

How can I get Emacs 21-style file-name completion in GNU Emacs 25.1.1?

How can I make file-name completion in GNU Emacs 25.1.1 act like it did in version 21.x.x? There are a few things that bother me: The *Completions* buffer opens up in a custom fit-to-content window. ...
ajk68's user avatar
  • 21
5 votes
1 answer
269 views

Automatically Uniquify Certain Buffers

Emacs does a wonderful job of disambiguating buffer names when I have several files with the same name open. That is, if I open a single main.cpp, the buffer is simply called main.cpp, but if I open ...
Silvio Mayolo's user avatar
2 votes
0 answers
76 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, ...
PRouleau's user avatar
  • 821
1 vote
1 answer
281 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")))...
johnymm's user avatar
  • 163
0 votes
2 answers
311 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 (...
Sahara's user avatar
  • 1
1 vote
1 answer
86 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.
matt's user avatar
  • 121
0 votes
0 answers
109 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 ...
P. Daegelen's user avatar
1 vote
2 answers
83 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-...
oleg harput's user avatar
2 votes
1 answer
223 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 ...
user1683620's user avatar
3 votes
1 answer
359 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 ...
yPhil's user avatar
  • 983
5 votes
4 answers
1k 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 ...
dharmatech's user avatar
  • 1,274
1 vote
2 answers
186 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 ...
juanerasmoe's user avatar
3 votes
1 answer
1k 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 ...
Nick Martin's user avatar
2 votes
1 answer
124 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 ...
sbac's user avatar
  • 419
1 vote
1 answer
234 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 ...
Edman's user avatar
  • 1,229
1 vote
2 answers
714 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 ...
ideasman42's user avatar
  • 8,846
1 vote
1 answer
59 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 ...
space_held's user avatar
2 votes
2 answers
612 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-...
Ryan West's user avatar
0 votes
0 answers
98 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/...
phoxd's user avatar
  • 231
1 vote
1 answer
85 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 ...
scribe's user avatar
  • 1,035
1 vote
1 answer
80 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 ...
Aankhen's user avatar
  • 111
1 vote
1 answer
78 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). ...
Gilles 'SO- stop being evil''s user avatar
1 vote
0 answers
160 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-...
henning no longer feeds AI's user avatar
0 votes
2 answers
308 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 ...
caseneuve's user avatar
  • 407
1 vote
1 answer
359 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 ...
Michael Hoffman's user avatar
0 votes
1 answer
738 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 ...
lawlist's user avatar
  • 19.2k
3 votes
2 answers
479 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. ...
lawlist's user avatar
  • 19.2k
2 votes
1 answer
352 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 ...
GDP2's user avatar
  • 1,350
3 votes
2 answers
219 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 ...
Håkon Hægland's user avatar
1 vote
1 answer
56 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 ...
user15559's user avatar
1 vote
1 answer
102 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 ...
gavenkoa's user avatar
  • 3,462
8 votes
1 answer
656 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 ...
sds's user avatar
  • 6,124