qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs dired.c extras.c qe.c qe.h qescript.c va...


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs dired.c extras.c qe.c qe.h qescript.c va...
Date: Sat, 24 Oct 2020 08:44:23 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        20/10/24 08:44:23

Modified files:
        .              : dired.c extras.c qe.c qe.h qescript.c 
                         variables.c variables.h 

Log message:
        Add command and variable descriptions:
        
        - add command and variable description field
        - add fuzzy completion on repeated TAB in minibuffer
        - remove fuzzy_search variable
        - add CompletionDef flags:
          - CF_FILENAME to use `/` as separator
          - CF_NO_FUZZY to prevent fuzzy matching on second TAB
          - CF_SPACE_OK to prevent SPC from completing entry
          - CF_NO_AUTO_SUBMIT to insert current match on ENTER
        - fix invalid free on CommandDef structures
        - improve symbol completion in eval-expression
        - use symbol completion in apropos
        - fix post increment and decrement evaluation

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/dired.c?cvsroot=qemacs&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.302&r2=1.303
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.283&r2=1.284
http://cvs.savannah.gnu.org/viewcvs/qemacs/qescript.c?cvsroot=qemacs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/qemacs/variables.c?cvsroot=qemacs&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/qemacs/variables.h?cvsroot=qemacs&r1=1.13&r2=1.14

Patches:
Index: dired.c
===================================================================
RCS file: /sources/qemacs/qemacs/dired.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- dired.c     21 Oct 2020 15:01:56 -0000      1.86
+++ dired.c     24 Oct 2020 12:44:23 -0000      1.87
@@ -119,11 +119,15 @@
 
 static VarDef dired_variables[] = {
     G_VAR_F( "dired-sort-mode", dired_sort_mode, VAR_NUMBER, VAR_RW_SAVE,
-            dired_sort_mode_set_value )
+            dired_sort_mode_set_value,
+            "Sort order for dired display: any combination of `nesdgur+-`" )
     G_VAR_F( "dired-time-format", dired_time_format, VAR_NUMBER, VAR_RW_SAVE,
-            dired_time_format_set_value )
-    G_VAR( "dired-show-dot-files", dired_show_dot_files, VAR_NUMBER, 
VAR_RW_SAVE )
-    G_VAR( "dired-show-ds-store", dired_show_ds_store, VAR_NUMBER, VAR_RW_SAVE 
)
+            dired_time_format_set_value,
+            "Format used for file times (default, compact, dos, dos-long, 
touch, touch-long, full, seconds)" )
+    G_VAR( "dired-show-dot-files", dired_show_dot_files, VAR_NUMBER, 
VAR_RW_SAVE,
+          "Set to show hidden files (starting with a `.`)" )
+    G_VAR( "dired-show-ds-store", dired_show_ds_store, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to show OS/X system file .DS_Store" )
 };
 
 static inline DiredState *dired_get_state(EditState *e, int status)

Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- extras.c    24 Oct 2020 08:04:30 -0000      1.81
+++ extras.c    24 Oct 2020 12:44:23 -0000      1.82
@@ -994,7 +994,10 @@
                 if (qe_list_bindings(d, s->mode, 1, buf, sizeof(buf)))
                     eb_printf(b, " bound to %s", buf);
                 eb_putc(b, '\n');
-                /* TODO: print short description */
+                if (d->desc && *d->desc) {
+                    /* print short description */
+                    eb_printf(b, "  %s", d->desc);
+                }
                 eb_putc(b, '\n');
                 found = 1;
             }
@@ -1012,7 +1015,10 @@
             qe_get_variable(s, vp->name, buf, sizeof(buf), NULL, 1);
             eb_printf(b, "%s variable: %s -> %s\n",
                       var_domain[vp->domain], vp->name, buf);
-            /* TODO: print short description */
+            if (vp->desc && *vp->desc) {
+                /* print short description */
+                eb_printf(b, "  %s", vp->desc);
+            }
             eb_putc(b, '\n');
             found = 1;
         }
@@ -1918,7 +1924,7 @@
           "about-qemacs", do_about_qemacs)
     CMD2( KEY_CTRLH('a'), KEY_CTRLH(KEY_CTRL('A')),
           "apropos", do_apropos, ESs,
-          "s{Apropos: }|apropos|")
+          "s{Apropos: }[symbol]|apropos|")
     CMD0( KEY_CTRLH('b'), KEY_NONE,
           "describe-bindings", do_describe_bindings)
     CMD2( KEY_CTRLH('B'), KEY_NONE,

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -b -r1.302 -r1.303
--- qe.c        21 Oct 2020 23:22:25 -0000      1.302
+++ qe.c        24 Oct 2020 12:44:23 -0000      1.303
@@ -6063,7 +6063,7 @@
 }
 
 static CompletionDef file_completion = {
-    "file", file_complete
+    "file", file_complete, NULL, NULL, CF_FILENAME | CF_NO_FUZZY
 };
 
 void buffer_complete(CompleteState *cp)
@@ -6145,14 +6145,13 @@
 /* XXX: should have a globbing option */
 void complete_test(CompleteState *cp, const char *str)
 {
-    QEmacsState *qs = &qe_state;
     int fuzzy = 0;
 
     if (memcmp(str, cp->current, cp->len)) {
         if (!qe_memicmp(str, cp->current, cp->len))
             fuzzy = 1;
         else
-        if (qs->fuzzy_search && strmem(str, cp->current, cp->len))
+        if (cp->fuzzy && strmem(str, cp->current, cp->len))
             fuzzy = 2;
         else
             return;
@@ -6186,6 +6185,7 @@
     void *opaque;
 
     EditState *completion_popup_window;  /* XXX: should have a popup_window 
member */
+    int completion_stage;
     int completion_flags;
     int completion_start;
     int completion_end;
@@ -6229,12 +6229,20 @@
      * completion_popup_window or close it.
      */
 
+    if (type == COMPLETION_TAB && qs->last_cmd_func == qs->this_cmd_func) {
+        mb->completion_stage++;
+        if (mb->completion->flags & CF_NO_FUZZY)
+            mb->completion_stage = 2;
+    } else {
+        mb->completion_stage = 0;
+    }
+
     /* check completion window */
     check_window(&mb->completion_popup_window);
-    if (mb->completion_popup_window
-    &&  type == COMPLETION_TAB
-    &&  qs->last_cmd_func == qs->this_cmd_func) {
-        /* toggle cpmpletion popup on TAB */
+    if (mb->completion_popup_window && mb->completion_stage > 1) {
+        /* toggle completion popup on TAB */
+        mb->completion_stage = 0;
+        qs->this_cmd_func = 0;
         edit_close(&mb->completion_popup_window);
         do_refresh(s);
         return;
@@ -6254,6 +6262,8 @@
     mb->completion_start = start;
     mb->completion_end = end;
     complete_start(&cs, s, start, end, s->target_window);
+    if (!(mb->completion->flags & CF_NO_FUZZY))
+        cs.fuzzy = mb->completion_stage;
     (*mb->completion->enumerate)(&cs);
     count = cs.cs.nb_items;
     outputs = cs.cs.items;
@@ -6360,7 +6370,7 @@
     int c, offset, stop;
     MinibufState *mb = minibuffer_get_state(s, 0);
 
-    if (mb && mb->completion == &file_completion) {
+    if (mb && mb->completion && (mb->completion->flags & CF_FILENAME)) {
         stop = s->offset;
         c = eb_prevc(s->b, s->offset, &offset);
         if (c == '/') {
@@ -6381,7 +6391,7 @@
     QEmacsState *qs = s->qe_state;
     MinibufState *mb = minibuffer_get_state(s, 0);
 
-    if (!mb || !mb->completion) {
+    if (!mb || !mb->completion || (mb->completion->flags & CF_SPACE_OK)) {
         do_char(s, ' ', 1);
     } else
     if (check_window(&mb->completion_popup_window)
@@ -6525,9 +6535,15 @@
             int len;
             len = mb->completion->get_entry(cw, buf, sizeof(buf), 
list_get_offset(cw) + 1);
             if (len > 0) {
-                eb_delete_range(s->b, s->b->mark, s->offset);     // delete 
highlighted completion
+                // delete highlighted completion
+                if (s->b->mark > s->offset)
+                    eb_delete_range(s->b, s->b->mark, s->offset);
                 minibuf_set_str(s, mb->completion_start, mb->completion_end, 
buf);
             }
+            if (mb->completion->flags & CF_NO_AUTO_SUBMIT) {
+                edit_close(&mb->completion_popup_window);
+                return;
+            }
         }
 
         eb_get_contents(s->b, buf, sizeof(buf));
@@ -8744,7 +8760,7 @@
 
 const char str_version[] = "QEmacs version " QE_VERSION;
 const char str_credits[] = "Copyright (c) 2000-2003 Fabrice Bellard\n"
-                           "Copyright (c) 2000-2019 Charlie Gordon\n";
+                           "Copyright (c) 2000-2020 Charlie Gordon\n";
 
 static void show_version(void)
 {
@@ -9364,11 +9380,6 @@
                 qe_free(&p);
             }
         }
-        while (qs->first_completion) {
-            CompletionDef *cp = qs->first_completion;
-            qs->first_completion = cp->next;
-            qe_free(&cp);
-        }
         css_free_colors();
         free_font_cache(&global_screen);
         qe_free(&qs->buffer_cache);

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -b -r1.283 -r1.284
--- qe.h        21 Oct 2020 23:22:25 -0000      1.283
+++ qe.h        24 Oct 2020 12:44:23 -0000      1.284
@@ -194,7 +194,7 @@
     StringArray cs;
     struct EditState *s;
     struct EditState *target;
-    int start, end, len;
+    int start, end, len, fuzzy;
     char current[MAX_FILENAME_SIZE];
 } CompleteState;
 
@@ -1729,7 +1729,6 @@
     int emulation_flags;
     int backspace_is_control_h;
     int backup_inhibited;  /* prevent qemacs from backing up files */
-    int fuzzy_search;    /* use fuzzy search for completion matcher */
     int c_label_indent;
     const char *user_option;
 };
@@ -1798,27 +1797,28 @@
 } CmdProto;
 
 typedef struct CmdDef {
+    const char *name;
+    const char *desc;
     unsigned short key;       /* normal key */
     unsigned short alt_key;   /* alternate key */
-    const char *name;
-    CmdProto action;
     CmdSig sig : 8;
     signed int val : 24;
+    CmdProto action;
 } CmdDef;
 
 /* new command macros */
 #define CMD2(key, key_alt, name, func, sig, args) \
-    { key, key_alt, name "\0" args, { .sig = func }, CMD_ ## sig, 0 },
+    { name "\0" args, NULL, key, key_alt, CMD_ ## sig, 0, { .sig = func } },
 #define CMD3(key, key_alt, name, func, sig, val, args) \
-    { key, key_alt, name "\0" args, { .sig = func }, CMD_ ## sig, val },
+    { name "\0" args, NULL, key, key_alt, CMD_ ## sig, val, { .sig = func } },
 
 /* old macros for compatibility */
 #define CMD0(key, key_alt, name, func) \
-    { key, key_alt, name "\0", { .ES = func }, CMD_ES, 0 },
+    { name "\0", NULL, key, key_alt, CMD_ES, 0, { .ES = func } },
 #define CMD1(key, key_alt, name, func, val) \
-    { key, key_alt, name "\0" "v", { .ESi = func }, CMD_ESi, val },
+    { name "\0" "v", NULL, key, key_alt, CMD_ESi, val, { .ESi = func } },
 #define CMD_DEF_END \
-    { 0, 0, NULL, { NULL }, CMD_void, 0 }
+    { NULL, NULL, 0, 0, CMD_void, 0, { NULL } }
 
 ModeDef *qe_find_mode(const char *name, int flags);
 ModeDef *qe_find_mode_filename(const char *filename, int flags);
@@ -2008,6 +2008,10 @@
     void (*enumerate)(CompleteState *cp);
     int (*print_entry)(CompleteState *cp, EditState *s, const char *name);
     int (*get_entry)(EditState *s, char *dest, int size, int offset);
+#define CF_FILENAME        1
+#define CF_NO_FUZZY        2
+#define CF_SPACE_OK        4
+#define CF_NO_AUTO_SUBMIT  8
     int flags;
     struct CompletionDef *next;
 } CompletionDef;

Index: qescript.c
===================================================================
RCS file: /sources/qemacs/qemacs/qescript.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- qescript.c  22 Oct 2020 08:53:41 -0000      1.4
+++ qescript.c  24 Oct 2020 12:44:23 -0000      1.5
@@ -586,7 +586,7 @@
                 return 1;
             case TOK_INC: /* post increment */
             case TOK_DEC: /* post decrement */
-                qe_cfg_set_num(sp, 1);
+                qe_cfg_set_num(sp + 1, 1);
                 if (qe_cfg_assign(ds, sp, op))
                     return 1;
                 sp->u.value -= (op == TOK_INC) ? 1 : -1;
@@ -1175,12 +1175,12 @@
 }
 #endif
 
-static void script_complete(CompleteState *cp) {
+static void symbol_complete(CompleteState *cp) {
     command_complete(cp);
     variable_complete(cp);
 }
 
-static int script_print_entry(CompleteState *cp, EditState *s, const char 
*name) {
+static int symbol_print_entry(CompleteState *cp, EditState *s, const char 
*name) {
     CmdDef *d = qe_find_cmd(name);
     if (d) {
         return command_print_entry(cp, s, name);
@@ -1189,15 +1189,16 @@
     }
 }
 
-static CompletionDef script_completion = {
-    "script", script_complete, script_print_entry, command_get_entry
+static CompletionDef symbol_completion = {
+    "symbol", symbol_complete, symbol_print_entry, command_get_entry,
+    CF_SPACE_OK | CF_NO_AUTO_SUBMIT
 };
 
 static CmdDef parser_commands[] = {
 
     CMD2( KEY_META(':'), KEY_NONE,
           "eval-expression", do_eval_expression, ESsi,
-          "s{Eval: }[.script]|expression|ui")
+          "s{Eval: }[.symbol]|expression|ui")
     CMD0( KEY_NONE, KEY_NONE,
           "eval-region", do_eval_region)
     CMD0( KEY_NONE, KEY_NONE,
@@ -1212,7 +1213,7 @@
 static int parser_init(void)
 {
     qe_register_cmd_table(parser_commands, NULL);
-    qe_register_completion(&script_completion);
+    qe_register_completion(&symbol_completion);
     return 0;
 }
 

Index: variables.c
===================================================================
RCS file: /sources/qemacs/qemacs/variables.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- variables.c 21 Oct 2020 09:55:02 -0000      1.29
+++ variables.c 24 Oct 2020 12:44:23 -0000      1.30
@@ -32,73 +32,109 @@
 
 static VarDef var_table[] = {
 
-    S_VAR( "screen-width", width, VAR_NUMBER, VAR_RO )
-    S_VAR( "screen-height", height, VAR_NUMBER, VAR_RO )
-    S_VAR( "is-full-screen", is_full_screen, VAR_NUMBER, VAR_RO )
-    S_VAR( "flag-split-window-change-focus", flag_split_window_change_focus, 
VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "backspace-is-control-h", backspace_is_control_h, VAR_NUMBER, 
VAR_RW_SAVE )
-    S_VAR( "ungot-key", ungot_key, VAR_NUMBER, VAR_RW )
-    S_VAR( "QEPATH", res_path, VAR_CHARS, VAR_RO )
-    //S_VAR( "it", it, VAR_NUMBER, VAR_RW )
-    S_VAR( "ignore-spaces", ignore_spaces, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "ignore-comments", ignore_comments, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "hilite-region", hilite_region, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "mmap-threshold", mmap_threshold, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "max-load-size", max_load_size, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "show-unicode", show_unicode, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "default-tab-width", default_tab_width, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "default-fill-column", default_fill_column, VAR_NUMBER, VAR_RW_SAVE 
)
-    S_VAR( "backup-inhibited", backup_inhibited, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "fuzzy-search", fuzzy_search, VAR_NUMBER, VAR_RW_SAVE )
-    S_VAR( "c-label-indent", c_label_indent, VAR_NUMBER, VAR_RW_SAVE )
-
-    //B_VAR( "screen-charset", charset, VAR_NUMBER, VAR_RW )
-
-    B_VAR( "mark", mark, VAR_NUMBER, VAR_RW )
-    B_VAR( "bufsize", total_size, VAR_NUMBER, VAR_RO )
-    B_VAR( "bufname", name, VAR_CHARS, VAR_RO )
-    B_VAR( "filename", filename, VAR_CHARS, VAR_RO )
-    B_VAR( "tab-width", tab_width, VAR_NUMBER, VAR_RW )
-    B_VAR( "fill-column", fill_column, VAR_NUMBER, VAR_RW )
-
-    W_VAR( "point", offset, VAR_NUMBER, VAR_RW )
-    W_VAR( "indent-width", indent_size, VAR_NUMBER, VAR_RW )
-    W_VAR( "indent-tabs-mode", indent_tabs_mode, VAR_NUMBER, VAR_RW )
-    W_VAR( "default-style", default_style, VAR_NUMBER, VAR_RW )
-    W_VAR( "region-style", region_style, VAR_NUMBER, VAR_RW )
-    W_VAR( "curline-style", curline_style, VAR_NUMBER, VAR_RW )
-    W_VAR( "window-width", width, VAR_NUMBER, VAR_RW )
-    W_VAR( "window-height", height, VAR_NUMBER, VAR_RW )
-    W_VAR( "window-left", xleft, VAR_NUMBER, VAR_RW )
-    W_VAR( "window-top", ytop, VAR_NUMBER, VAR_RW )
-    W_VAR( "window-prompt", prompt, VAR_STRING, VAR_RW )
-    W_VAR( "dump-width", dump_width, VAR_NUMBER, VAR_RW )
-
-    M_VAR( "mode-name", name, VAR_STRING, VAR_RO )
-    M_VAR( "auto-indent", auto_indent, VAR_NUMBER, VAR_RW )
-
-    G_VAR( "use-session-file", use_session_file, VAR_NUMBER, VAR_RW )
-    G_VAR( "force-tty", force_tty, VAR_NUMBER, VAR_RW )
-    G_VAR( "disable-crc", disable_crc, VAR_NUMBER, VAR_RW_SAVE )
-    G_VAR( "use-html", use_html, VAR_NUMBER, VAR_RW )
+    S_VAR( "screen-width", width, VAR_NUMBER, VAR_RO,
+          "Number of columns available for display on screen." )
+    S_VAR( "screen-height", height, VAR_NUMBER, VAR_RO,
+          "Number of lines available for display on screen." )
+    S_VAR( "is-full-screen", is_full_screen, VAR_NUMBER, VAR_RO,
+          "Set if this window is displayed in full screen (without borders)." )
+    S_VAR( "flag-split-window-change-focus", flag_split_window_change_focus, 
VAR_NUMBER, VAR_RW_SAVE,
+          "Set if `split-window` should set focus to the new window." )
+    S_VAR( "backspace-is-control-h", backspace_is_control_h, VAR_NUMBER, 
VAR_RW_SAVE,
+          "Set if the Delete key sends a control-H." )
+    S_VAR( "ungot-key", ungot_key, VAR_NUMBER, VAR_RW, NULL )
+    S_VAR( "QEPATH", res_path, VAR_CHARS, VAR_RO,
+          "List of directories to search for standard files to load." )
+    //S_VAR( "it", it, VAR_NUMBER, VAR_RW, NULL )
+    S_VAR( "ignore-spaces", ignore_spaces, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to ignore spaces in compare-windows." )
+    S_VAR( "ignore-comments", ignore_comments, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to ignore comments in compare-windows." )
+    S_VAR( "hilite-region", hilite_region, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to highlight the region after setting the mark." )
+    S_VAR( "mmap-threshold", mmap_threshold, VAR_NUMBER, VAR_RW_SAVE,
+          "Size from which files are mmapped instead of loaded in memory." )
+    S_VAR( "max-load-size", max_load_size, VAR_NUMBER, VAR_RW_SAVE,
+          "Maximum size for files to be loaded or mmapped into a buffer." )
+    S_VAR( "show-unicode", show_unicode, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to show non-ASCII characters as unicode escape sequences." )
+    S_VAR( "default-tab-width", default_tab_width, VAR_NUMBER, VAR_RW_SAVE,
+          "Default value of `tab-width` for buffers that do not override it." )
+    S_VAR( "default-fill-column", default_fill_column, VAR_NUMBER, VAR_RW_SAVE,
+          "Default value of `fill-column` for buffers that do not override it" 
)
+    S_VAR( "backup-inhibited", backup_inhibited, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to prevent automatic backups of modified files" )
+    S_VAR( "c-label-indent", c_label_indent, VAR_NUMBER, VAR_RW_SAVE,
+          "Number of columns to adjust indentation of C labels." )
+
+    //B_VAR( "screen-charset", charset, VAR_NUMBER, VAR_RW, NULL )
+
+    B_VAR( "mark", mark, VAR_NUMBER, VAR_RW,
+          "The position of the beginning of the current region." )
+    B_VAR( "bufsize", total_size, VAR_NUMBER, VAR_RO,
+          "The number of bytes in the current buffer." )
+    B_VAR( "bufname", name, VAR_CHARS, VAR_RO,
+          "The name of the current buffer." )
+    B_VAR( "filename", filename, VAR_CHARS, VAR_RO,
+          "The name of the file associated with the current buffer." )
+    B_VAR( "tab-width", tab_width, VAR_NUMBER, VAR_RW,
+          "Distance between tab stops (for display of tab characters), in 
columns." )
+    B_VAR( "fill-column", fill_column, VAR_NUMBER, VAR_RW,
+          "Column beyond which automatic line-wrapping should happen." )
+
+    W_VAR( "point", offset, VAR_NUMBER, VAR_RW,     /* should be window-point 
*/
+          "Current value of point in this window." )
+    W_VAR( "indent-width", indent_size, VAR_NUMBER, VAR_RW,
+          "Number of columns to indent by for a syntactic level." )
+    W_VAR( "indent-tabs-mode", indent_tabs_mode, VAR_NUMBER, VAR_RW,
+          "Set if indentation can insert tabs." )
+    W_VAR( "default-style", default_style, VAR_NUMBER, VAR_RW,
+          "Default text style for this window." )
+    W_VAR( "region-style", region_style, VAR_NUMBER, VAR_RW,
+          "Text style for the current region in this window." )
+    W_VAR( "curline-style", curline_style, VAR_NUMBER, VAR_RW,
+          "Text style for the current line in this window." )
+    W_VAR( "window-width", width, VAR_NUMBER, VAR_RW,
+          "Number of display columns in this window." )
+    W_VAR( "window-height", height, VAR_NUMBER, VAR_RW,
+          "Number of display lines in this window." )
+    W_VAR( "window-left", xleft, VAR_NUMBER, VAR_RW,
+          "Display column of the left edge of this window." )
+    W_VAR( "window-top", ytop, VAR_NUMBER, VAR_RW,
+          "Display line of the top edge of this window." )
+    W_VAR( "window-prompt", prompt, VAR_STRING, VAR_RW,
+          "Prompt string to show for this window." )
+    W_VAR( "dump-width", dump_width, VAR_NUMBER, VAR_RW, NULL )
+
+    M_VAR( "mode-name", name, VAR_STRING, VAR_RO,
+          "Name of the current major mode." )
+    M_VAR( "auto-indent", auto_indent, VAR_NUMBER, VAR_RW,
+          "Set for automatic indentation on new lines." )
+
+    G_VAR( "use-session-file", use_session_file, VAR_NUMBER, VAR_RW, NULL )
+    G_VAR( "force-tty", force_tty, VAR_NUMBER, VAR_RW,
+          "Set to prevent graphics display." )
+    G_VAR( "disable-crc", disable_crc, VAR_NUMBER, VAR_RW_SAVE,
+          "Set to prevent CRC based display cache." )
+    G_VAR( "use-html", use_html, VAR_NUMBER, VAR_RW, NULL )
 
     /* more buffer fields: modified, readonly, binary, charset */
 
     /* more window fields: mode_line, color, input_method...
      */
 
-    //G_VAR( "text-mode-line", text_mode.mode_line, VAR_STRING, VAR_RW )
-    //G_VAR( "binary-mode-line", binary_mode.mode_line, VAR_STRING, VAR_RW )
-    //G_VAR( "hex-mode-line", hex_mode.mode_line, VAR_STRING, VAR_RW )
-    //G_VAR( "unicode-mode-line", unihex_mode.mode_line, VAR_STRING, VAR_RW )
+    //G_VAR( "text-mode-line", text_mode.mode_line, VAR_STRING, VAR_RW, NULL )
+    //G_VAR( "binary-mode-line", binary_mode.mode_line, VAR_STRING, VAR_RW, 
NULL )
+    //G_VAR( "hex-mode-line", hex_mode.mode_line, VAR_STRING, VAR_RW, NULL )
+    //G_VAR( "unicode-mode-line", unihex_mode.mode_line, VAR_STRING, VAR_RW, 
NULL )
 
     //Dispatch these to the appropriate modules
-    //G_VAR( "c-mode-extensions", c_mode.extensions, VAR_STRING, VAR_RW )
-    //G_VAR( "c-mode-keywords", c_mode.keywords, VAR_STRING, VAR_RW )
-    //G_VAR( "c-mode-types", c_mode.types, VAR_STRING, VAR_RW )
-    //G_VAR( "html-src-mode-extensions", htmlsrc_mode.extensions, VAR_STRING, 
VAR_RW )
-    //G_VAR( "html-mode-extensions", html_mode.extensions, VAR_STRING, VAR_RW )
-    //G_VAR( "perl-mode-extensions", perl_mode.extensions, VAR_STRING, VAR_RW )
+    //G_VAR( "c-mode-extensions", c_mode.extensions, VAR_STRING, VAR_RW, NULL )
+    //G_VAR( "c-mode-keywords", c_mode.keywords, VAR_STRING, VAR_RW, NULL )
+    //G_VAR( "c-mode-types", c_mode.types, VAR_STRING, VAR_RW, NULL )
+    //G_VAR( "html-src-mode-extensions", htmlsrc_mode.extensions, VAR_STRING, 
VAR_RW, NULL )
+    //G_VAR( "html-mode-extensions", html_mode.extensions, VAR_STRING, VAR_RW, 
NULL )
+    //G_VAR( "perl-mode-extensions", perl_mode.extensions, VAR_STRING, VAR_RW, 
NULL )
 };
 
 VarDef *qe_find_variable(const char *name)

Index: variables.h
===================================================================
RCS file: /sources/qemacs/qemacs/variables.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- variables.h 17 Oct 2020 21:09:49 -0000      1.13
+++ variables.h 24 Oct 2020 12:44:23 -0000      1.14
@@ -50,6 +50,7 @@
 typedef struct VarDef VarDef;
 struct VarDef {
     const char *name;
+    const char *desc;
     unsigned int modified : 1;
     enum QVarDomain domain : 4;
     enum QVarType type : 4;
@@ -68,30 +69,30 @@
     VarDef *next;
 };
 
-#define U_VAR_F(name, type, fun) \
-    { (name), 0, VAR_SELF, type, VAR_RW, 0, { .num = 0 }, fun, NULL },
-#define G_VAR_F(name, var, type, rw, fun) \
-    { (name), 0, VAR_GLOBAL, type, rw, 0, \
+#define U_VAR_F(name, type, fun, desc) \
+    { (name), desc, 0, VAR_SELF, type, VAR_RW, 0, { .num = 0 }, fun, NULL },
+#define G_VAR_F(name, var, type, rw, fun, desc) \
+    { (name), desc, 0, VAR_GLOBAL, type, rw, 0, \
       { .ptr = (void*)&(var) }, fun, NULL },
-#define S_VAR_F(name, fld, type, rw, fun) \
-    { (name), 0, VAR_STATE, type, rw, sizeof(((QEmacsState*)0)->fld), \
+#define S_VAR_F(name, fld, type, rw, fun, desc) \
+    { (name), desc, 0, VAR_STATE, type, rw, sizeof(((QEmacsState*)0)->fld), \
       { .offset = offsetof(QEmacsState, fld) }, fun, NULL },
-#define B_VAR_F(name, fld, type, rw, fun) \
-    { (name), 0, VAR_BUFFER, type, rw, sizeof(((EditBuffer*)0)->fld), \
+#define B_VAR_F(name, fld, type, rw, fun, desc) \
+    { (name), desc, 0, VAR_BUFFER, type, rw, sizeof(((EditBuffer*)0)->fld), \
       { .offset = offsetof(EditBuffer, fld) }, fun, NULL },
-#define W_VAR_F(name, fld, type, rw, fun) \
-    { (name), 0, VAR_WINDOW, type, rw, sizeof(((EditState*)0)->fld), \
+#define W_VAR_F(name, fld, type, rw, fun, desc) \
+    { (name), desc, 0, VAR_WINDOW, type, rw, sizeof(((EditState*)0)->fld), \
       { .offset = offsetof(EditState, fld) }, fun, NULL },
-#define M_VAR_F(name, fld, type, rw, fun) \
-    { (name), 0, VAR_MODE, type, rw, sizeof(((ModeDef*)0)->fld), \
+#define M_VAR_F(name, fld, type, rw, fun, desc) \
+    { (name), desc, 0, VAR_MODE, type, rw, sizeof(((ModeDef*)0)->fld), \
       { .offset = offsetof(ModeDef, fld) }, fun, NULL },
 
-#define U_VAR(name,type)         U_VAR_F(name, type, NULL)
-#define G_VAR(name,var,type,rw)  G_VAR_F(name, var, type, rw, NULL)
-#define S_VAR(name,fld,type,rw)  S_VAR_F(name, fld, type, rw, NULL)
-#define B_VAR(name,fld,type,rw)  B_VAR_F(name, fld, type, rw, NULL)
-#define W_VAR(name,fld,type,rw)  W_VAR_F(name, fld, type, rw, NULL)
-#define M_VAR(name,fld,type,rw)  M_VAR_F(name, fld, type, rw, NULL)
+#define U_VAR(name,type,desc)         U_VAR_F(name, type, NULL, desc)
+#define G_VAR(name,var,type,rw,desc)  G_VAR_F(name, var, type, rw, NULL, desc)
+#define S_VAR(name,fld,type,rw,desc)  S_VAR_F(name, fld, type, rw, NULL, desc)
+#define B_VAR(name,fld,type,rw,desc)  B_VAR_F(name, fld, type, rw, NULL, desc)
+#define W_VAR(name,fld,type,rw,desc)  W_VAR_F(name, fld, type, rw, NULL, desc)
+#define M_VAR(name,fld,type,rw,desc)  M_VAR_F(name, fld, type, rw, NULL, desc)
 
 void qe_register_variables(VarDef *vars, int count);
 VarDef *qe_find_variable(const char *name);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]