diff options
| author | Stefan Kangas | 2021-10-26 23:17:29 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-10-26 23:19:10 +0200 |
| commit | e45b3fc521acca47abdd2b9e491b9fbbd8d3e677 (patch) | |
| tree | ef4fde0447d73de42c53edcee2dd7df5f890c68c | |
| parent | 284c77eeb60bf21d8811f011902cd56f4aeaddca (diff) | |
| download | emacs-e45b3fc521acca47abdd2b9e491b9fbbd8d3e677.tar.gz emacs-e45b3fc521acca47abdd2b9e491b9fbbd8d3e677.zip | |
Improve function documentation with text from XDG BDS spec
* lisp/xdg.el (xdg-config-home, xdg-cache-home, xdg-data-home)
(xdg-runtime-dir, xdg-config-dirs, xdg-data-dirs): Copy in the
text from the XDG Base Directory Specification to better explain
what these functions return.
| -rw-r--r-- | lisp/xdg.el | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/lisp/xdg.el b/lisp/xdg.el index 1f9fa6795e0..db890f9494b 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el | |||
| @@ -50,30 +50,84 @@ | |||
| 50 | ,env)))) | 50 | ,env)))) |
| 51 | 51 | ||
| 52 | (defun xdg-config-home () | 52 | (defun xdg-config-home () |
| 53 | "Return the base directory for user specific configuration files." | 53 | "Return the base directory for user specific configuration files. |
| 54 | |||
| 55 | According to the XDG Base Directory Specification version | ||
| 56 | 0.8 (8th May 2021): | ||
| 57 | |||
| 58 | \"$XDG_CONFIG_HOME defines the base directory relative to | ||
| 59 | which user-specific configuration files should be stored. | ||
| 60 | If $XDG_CONFIG_HOME is either not set or empty, a default | ||
| 61 | equal to $HOME/.config should be used.\"" | ||
| 54 | (xdg--dir-home "XDG_CONFIG_HOME" "~/.config")) | 62 | (xdg--dir-home "XDG_CONFIG_HOME" "~/.config")) |
| 55 | 63 | ||
| 56 | (defun xdg-cache-home () | 64 | (defun xdg-cache-home () |
| 57 | "Return the base directory for user specific cache files." | 65 | "Return the base directory for user specific cache files. |
| 66 | |||
| 67 | According to the XDG Base Directory Specification version | ||
| 68 | 0.8 (8th May 2021): | ||
| 69 | |||
| 70 | \"$XDG_CACHE_HOME defines the base directory relative to | ||
| 71 | which user-specific non-essential data files should be | ||
| 72 | stored. If $XDG_CACHE_HOME is either not set or empty, a | ||
| 73 | default equal to $HOME/.cache should be used.\"" | ||
| 58 | (xdg--dir-home "XDG_CACHE_HOME" "~/.cache")) | 74 | (xdg--dir-home "XDG_CACHE_HOME" "~/.cache")) |
| 59 | 75 | ||
| 60 | (defun xdg-data-home () | 76 | (defun xdg-data-home () |
| 61 | "Return the base directory for user specific data files." | 77 | "Return the base directory for user specific data files. |
| 78 | |||
| 79 | According to the XDG Base Directory Specification version | ||
| 80 | 0.8 (8th May 2021): | ||
| 81 | |||
| 82 | \"$XDG_DATA_HOME defines the base directory relative to which | ||
| 83 | user-specific data files should be stored. If $XDG_DATA_HOME is | ||
| 84 | either not set or empty, a default equal to $HOME/.local/share | ||
| 85 | should be used.\"" | ||
| 62 | (xdg--dir-home "XDG_DATA_HOME" "~/.local/share")) | 86 | (xdg--dir-home "XDG_DATA_HOME" "~/.local/share")) |
| 63 | 87 | ||
| 64 | (defun xdg-runtime-dir () | 88 | (defun xdg-runtime-dir () |
| 65 | "Return the value of $XDG_RUNTIME_DIR." | 89 | "Return the value of $XDG_RUNTIME_DIR. |
| 90 | |||
| 91 | According to the XDG Base Directory Specification version | ||
| 92 | 0.8 (8th May 2021): | ||
| 93 | |||
| 94 | \"$XDG_RUNTIME_DIR defines the base directory relative to | ||
| 95 | which user-specific non-essential runtime files and other | ||
| 96 | file objects (such as sockets, named pipes, ...) should be | ||
| 97 | stored.\"" | ||
| 66 | (getenv "XDG_RUNTIME_DIR")) | 98 | (getenv "XDG_RUNTIME_DIR")) |
| 67 | 99 | ||
| 68 | (defun xdg-config-dirs () | 100 | (defun xdg-config-dirs () |
| 69 | "Return the config directory search path as a list." | 101 | "Return the config directory search path as a list. |
| 102 | |||
| 103 | According to the XDG Base Directory Specification version | ||
| 104 | 0.8 (8th May 2021): | ||
| 105 | |||
| 106 | \"$XDG_CONFIG_DIRS defines the preference-ordered set of base | ||
| 107 | directories to search for configuration files in addition to | ||
| 108 | the $XDG_CONFIG_HOME base directory. The directories in | ||
| 109 | $XDG_CONFIG_DIRS should be seperated with a colon ':'. | ||
| 110 | |||
| 111 | \"If $XDG_CONFIG_DIRS is either not set or empty, a value equal to | ||
| 112 | /etc/xdg should be used.\"" | ||
| 70 | (let ((env (getenv "XDG_CONFIG_DIRS"))) | 113 | (let ((env (getenv "XDG_CONFIG_DIRS"))) |
| 71 | (if (or (null env) (string= env "")) | 114 | (if (or (null env) (string= env "")) |
| 72 | '("/etc/xdg") | 115 | '("/etc/xdg") |
| 73 | (parse-colon-path env)))) | 116 | (parse-colon-path env)))) |
| 74 | 117 | ||
| 75 | (defun xdg-data-dirs () | 118 | (defun xdg-data-dirs () |
| 76 | "Return the data directory search path as a list." | 119 | "Return the data directory search path as a list. |
| 120 | |||
| 121 | According to the XDG Base Directory Specification version | ||
| 122 | 0.8 (8th May 2021): | ||
| 123 | |||
| 124 | \"$XDG_DATA_DIRS defines the preference-ordered set of base | ||
| 125 | directories to search for data files in addition to the | ||
| 126 | $XDG_DATA_HOME base directory. The directories in | ||
| 127 | $XDG_DATA_DIRS should be seperated with a colon ':'. | ||
| 128 | |||
| 129 | \"If $XDG_DATA_DIRS is either not set or empty, a value equal | ||
| 130 | to /usr/local/share/:/usr/share/ should be used.\"" | ||
| 77 | (let ((env (getenv "XDG_DATA_DIRS"))) | 131 | (let ((env (getenv "XDG_DATA_DIRS"))) |
| 78 | (if (or (null env) (string= env "")) | 132 | (if (or (null env) (string= env "")) |
| 79 | '("/usr/local/share/" "/usr/share/") | 133 | '("/usr/local/share/" "/usr/share/") |