summaryrefslogtreecommitdiff
path: root/personal/itches.md
diff options
context:
space:
mode:
Diffstat (limited to 'personal/itches.md')
-rw-r--r--personal/itches.md64
1 files changed, 63 insertions, 1 deletions
diff --git a/personal/itches.md b/personal/itches.md
index a11ab43..2c1b295 100644
--- a/personal/itches.md
+++ b/personal/itches.md
@@ -14,7 +14,6 @@
- [.dir-locals changed priorities][bug#30008] between subfolder and
major mode from 25 to 26
- eshell: `ls --group-directories-first` does not color folders
-- make " Narrow" lighter customizable (src/xdisp.c)
- Emoji(One) support
- eww, gnus-article: adapt filling to window width changes
- scroll-lock-mode
@@ -43,6 +42,69 @@
[bug#30008]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30008
+## Make " Narrow" lighter customizable
+
+The " Narrow" string comes from `src/xdisp.c:decode_mode_spec`.
+
+TODO:
+
+1. get the string value of a variable in C
+2. define a customizable string variable
+
+### Get the string value of a variable in C
+
+`decode_mode_spec` has some relevant snippets:
+
+- Given a `Lisp_Object obj`, `SSDATA(obj)` gives the string value as a
+ `char*`.
+
+- How to get a variable's `Lisp_Object`?
+ - `BVAR` works for buffer-local variables
+ - `V${lispname//-/_}`
+
+### Define a customizable string variable
+
+#### Defining variables visible to C code
+
+The C macro `DEFVAR_LISP(string-name, field-name)` does the following:
+
+ define a static `Lisp_Objfwd` variable v
+ get the address of globals._f##field-name &f
+
+ defvar_lisp(v, string-name, &f)
+
+As explained in the comments above `DEFVAR_LISP`, `globals` is a
+global variable defined in `globals.h`, which is "auto-generated by
+make-docfile" and exposes fields, `#define`s and `Lisp_Object`s for
+every global variable.
+
+make-docfile (`lib-src/make-docfile.c`) takes C files as input and
+searches all occurences of `^ +DEFSYM[ \t(]`, `^ +DEFVAR_[ILB]` or
+`^DEFU`, analyses what comes after and generates appropriate
+definitions for `globals.h`.
+
+`defvar_lisp` allocates a symbol using `Fmake_symbol`.
+
+#### Making it customizable
+
+`lisp/cus-start.el` defines customizable properties of symbols defined
+by C code.
+
+AFAICT, there is no need to assign the default value right after
+defining the variable with `DEFVAR_LISP`: e.g. `shell-file-name` is
+`DEFVAR_LISP`ed in `src/callproc.c` and its default value is set in…
+Mmm. Not in `cus-start.el`. There is this snippet in
+`callproc.c:init_callproc`:
+
+ ``` C
+ sh = getenv ("SHELL");
+ Vshell_file_name = build_string (sh ? sh : "/bin/sh");
+ ```
+
+But when starting with `SHELL=rofl emacs -Q`, Custom says that the
+value "has been changed outside Customize". Changed from what to
+what?
+
## Better out-of-the-box display for FORM FEED
By default, FORM FEED is displayed as a dumb `^L` glyph. This is