Skip to content

Commit

Permalink
Shorten XDG directory file names
Browse files Browse the repository at this point in the history
  • Loading branch information
unrealapex committed Sep 20, 2024
1 parent bb6507d commit ac33b94
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/faq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/invoke.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions share/initialization/default
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion share/initialization/sample
Original file line number Diff line number Diff line change
@@ -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.


Expand Down
15 changes: 8 additions & 7 deletions yash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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"))
Expand Down

0 comments on commit ac33b94

Please sign in to comment.