From ac33b94b8a57555304fe26410bca9861872185dc Mon Sep 17 00:00:00 2001 From: Aaron John Date: Fri, 20 Sep 2024 11:06:37 -0700 Subject: [PATCH] Shorten XDG directory file names --- README.md | 12 ++++++------ doc/faq.txt | 2 +- doc/invoke.txt | 4 ++-- share/initialization/default | 4 ++-- share/initialization/sample | 2 +- yash.c | 15 ++++++++------- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e92d2b6c..03e80941 100644 --- a/README.md +++ b/README.md @@ -66,16 +66,16 @@ details, see the manual. ### Initialization scripts -When yash is started as a login shell, it reads `~/.config/yash/yash_profile`. This -file is a shell script in which you define environment variables using -the export command. +When yash is started as a login shell, it reads `~/.config/yash/profile` or +`~/.yash_profile` as a fallback. This file is a shell script in which you +define environment variables using the export command. -When yash is started for an interactive use, it reads `~/.config/yash/yashrc` -or `~/.yashrc` (after reading `~/.config/yash/yash_profile` if it is a login +When yash is started for an interactive use, it reads `~/.config/yash/rc` +or `~/.yashrc` (after reading `~/.config/yash/profile` if it is a login shell also). In this file, you make other configurations such as aliases, prompt strings, key bindings for command line editing, and command-not-found handler. Use the [share/initialization/sample](share/initialization/sample) -file as a template for your `~/.config/yash/yashrc`. +file as a template for your `~/.config/yash/rc`. ### Making yash your login shell diff --git a/doc/faq.txt b/doc/faq.txt index 0d3c97cf..fd7c5baa 100644 --- a/doc/faq.txt +++ b/doc/faq.txt @@ -48,7 +48,7 @@ variable to a different value. Please consult your OS's documentation to learn how to configure these variables in detail. If you want to apply the same configuration every time you start yash, write -the command in ~/.config/yashrc or ~/.config/yash_profile. The old locations +the command in ~/.config/yash/rc or ~/.config/yash/profile. The old locations ~/.yashrc and ~/.yash_profile are also supported as a fallback. If yash still rejects Unicode characters being entered, see the section below diff --git a/doc/invoke.txt b/doc/invoke.txt index 4454ac8c..0cce7fb7 100644 --- a/doc/invoke.txt +++ b/doc/invoke.txt @@ -92,14 +92,14 @@ Yash initializes itself as follows: specified or the shell is in the link:posix.html[POSIXly-correct mode]. + If the +--profile={{filename}}+ option is not specified, the shell reads - link:expand.html#tilde[~]/.yash_profile as a default. + link:expand.html#tilde[~]/.config/yash/profile as a default. .. If in the interactive mode, the shell reads the file specified by the +--rcfile={{filename}}+ option unless the +--norcfile+ option is specified. + If the +--rcfile={{filename}}+ option is not specified, the shell instead reads the following files: - If not in the POSIXly-correct mode, the shell reads - YASH_RC, link:expand.html#tilde[~]/.config/yash/yashrc or + link:expand.html#tilde[~]/.config/yash/rc or link:expand.html#tilde[~]/.yashrc. If it cannot be read, the shell searches link:params.html#sv-yash_loadpath[+YASH_LOADPATH+] for a file named initialization/default. diff --git a/share/initialization/default b/share/initialization/default index 35457d2b..f2ad0b7e 100644 --- a/share/initialization/default +++ b/share/initialization/default @@ -1,6 +1,6 @@ ##### Default Yashrc ##### # This file is automatically loaded when yash starts up and a user-specific -# initialization script cannot be read from ~/.config/yash/yashrc or ~/.yashrc. +# initialization script cannot be read from ~/.config/yash/rc or ~/.yashrc. # This file is in the public domain. # print introduction @@ -10,7 +10,7 @@ cat <<__END__ Welcome to yash! You are seeing this message because a user-specific initialization script is -not found at ~/.config/yash/yashrc or ~/.yashrc. The current session has been loaded with common +not found at ~/.config/yash/rc or ~/.yashrc. The current session has been loaded with common settings that should be useful for many users. To suppress this message, copy a sample initialization script from ${yashdatadir}/initialization/sample to ~/.yashrc and make any customization in it if you want. For bare default diff --git a/share/initialization/sample b/share/initialization/sample index b910090c..3556d6be 100644 --- a/share/initialization/sample +++ b/share/initialization/sample @@ -1,6 +1,6 @@ ##### Sample Yashrc ##### # This is a sample initialization script for yash. Copy this file to -# ~/.config/yash/yashrc or ~/.yashrc +# ~/.config/yash/rc or ~/.yashrc # and add your favorite customization to it. diff --git a/yash.c b/yash.c index 45bf1224..1a62dcba 100644 --- a/yash.c +++ b/yash.c @@ -256,23 +256,24 @@ struct input_file_info_T *new_input_file_info(int fd, size_t bufsize) return info; } -/* Executes "$HOME/.yash_profile". */ +/* Executes "$HOME/.config/yash/profile" or "$HOME/.yash_profile" as a fallback. + */ void execute_profile(const wchar_t *profile) { if (profile != NULL) execute_file(profile); else - if (execute_file_in_home(L".config/yash/yash_profile")) + if (execute_file_in_home(L".config/yash/profile")) return; execute_file_in_home(L".yash_profile"); } /* Executes the initialization file. `rcfile' is the filename to source. -* If `rcfile' is NULL, it tries reading $YASH_RC, if it is not defined it -* defaults to "$HOME/.config/yash/yashrc", or "~/.yashrc" and finally if the file cannot -* be read it falls back to "initialization/default" from $YASH_LOADPATH. -* In the POSIXly-correct mode, `rcfile' is ignored and "$ENV" is used. */ +*If `rcfile' is NULL, defaults to "$HOME/.config/yash/rc", or "~/.yashrc" as a +fallback and * finally if the file cannot * be read it falls back to +"initialization/default" * from $YASH_LOADPATH. * In the POSIXly-correct mode, +`rcfile' is ignored and * "$ENV" is used. */ void execute_rcfile(const wchar_t *rcfile) { if (posixly_correct) { @@ -289,7 +290,7 @@ void execute_rcfile(const wchar_t *rcfile) execute_file(rcfile); return; } - if (execute_file_in_home(L".config/yash/yashrc")) + if (execute_file_in_home(L".config/yash/rc")) return; if (execute_file_in_home(L".yashrc"))