]> git.neil.brown.name Git - edlib.git/commitdiff
doc: change Call:Notify:doc: to doc:Notify:doc:
authorNeilBrown <neil@brown.name>
Sat, 7 Sep 2019 21:48:54 +0000 (07:48 +1000)
committerNeilBrown <neil@brown.name>
Tue, 10 Sep 2019 06:41:22 +0000 (16:41 +1000)
As well a passing doc: commands onto the document, we currently
special case Request:Notify:doc and Call:Notify:doc the same way.
This is unnecessary.  If we change the commands to
  doc:Request:Notify: and  doc:Notify:
no special casing is needed.

Signed-off-by: NeilBrown <neil@brown.name>
13 files changed:
core-doc.c
doc-docs.c
doc-multipart.c
doc-text.c
emacs-search.c
lib-history.c
lib-linecount.c
lib-view.c
python/lib-server.py
python/module-notmuch.py
python/render-present.py
render-hex.c
render-lines.c

index 064615b5f4192671c2e6b56830b320848ab8f3cd..5158ed37a36ba1c0eddac5e6c51e14e1bb5d732f 100644 (file)
@@ -528,14 +528,18 @@ DEF_CMD(doc_set_parent)
 DEF_CMD(doc_request_notify)
 {
        struct doc *d = ci->home->data;
-       pane_add_notify(ci->focus, ci->home, ci->key+8);
+
+       /* Key starts "doc:Request:Notify:" */
+       pane_add_notify(ci->focus, ci->home, ci->key+12);
        return d->filter ? 0 : 1;
 }
 
 DEF_CMD(doc_notify)
 {
-       int ret = home_pane_notify(ci->home, ci->key + 5, ci->focus, ci->num, ci->mark, ci->str,
-                             ci->num2, ci->mark2, ci->str2, ci->comm2);
+       /* Key is "doc:Notify:..." */
+       int ret = home_pane_notify(ci->home, ci->key + 4, ci->focus,
+                                  ci->num, ci->mark, ci->str,
+                                  ci->num2, ci->mark2, ci->str2, ci->comm2);
        /* Mustn't return 0, else will fall through to next doc */
        return ret ?: Enotarget;
 }
@@ -1092,8 +1096,6 @@ static void init_doc_cmds(void)
        doc_handle_cmd = key_alloc();
 
        key_add_range(doc_handle_cmd, "doc:", "doc;", &doc_pass_on);
-       key_add_range(doc_handle_cmd, "Request:Notify:doc:", "Request:Notify:doc;", &doc_pass_on);
-       key_add_range(doc_handle_cmd, "Call:Notify:doc:", "Call:Notify:doc;", &doc_pass_on);
 
        key_add(doc_handle_cmd, "Move-Char", &doc_char);
        key_add(doc_handle_cmd, "Move-Word", &doc_word);
@@ -1135,9 +1137,9 @@ static void init_doc_cmds(void)
        key_add(doc_default_cmd, "doc:push-point", &doc_push_point);
        key_add(doc_default_cmd, "doc:pop-point", &doc_pop_point);
 
-       key_add_range(doc_default_cmd, "Request:Notify:doc:", "Request:Notify:doc;",
+       key_add_range(doc_default_cmd, "doc:Request:Notify:", "doc:Request:Notify;",
                      &doc_request_notify);
-       key_add_range(doc_default_cmd, "Call:Notify:doc:", "Call:Notify:doc;",
+       key_add_range(doc_default_cmd, "doc:Notify:", "doc:Notify;",
                      &doc_notify);
        key_add_range(doc_default_cmd, "doc:set:", "doc:set;",
                      &doc_set);
index 4acfcc8391525e3bc1cbadf5b0a604a457576a80..2b57af5e26c3cd8b2a67a4e026b1d796e5c64cbd 100644 (file)
@@ -401,7 +401,7 @@ DEF_CMD(docs_callback)
        if (strcmp(ci->key, "docs:show-modified") == 0) {
                p = doc_attach_view(ci->focus, doc->doc.home, NULL, NULL, 1);
                p = pane_register(p, 0, &docs_modified_handle.c, doc, NULL);
-               call("Request:Notify:doc:Replace", p);
+               call("doc:Request:Notify:doc:Replace", p);
                /* And trigger Notify:doc:Replace handling immediately...*/
                pane_call(p, "Notify:doc:Replace", p);
                /* Don't want to inherit position from some earlier instance,
@@ -425,7 +425,7 @@ DEF_CMD(docs_callback)
                        /* The docs doc is attached separately */
                        return Efallthrough;
                home_call(p, "doc:set-parent", doc->collection);
-               home_call(p, "Request:Notify:doc:status-changed", doc->collection);
+               home_call(p, "doc:Request:Notify:doc:status-changed", doc->collection);
                if (p->parent)
                        doc_checkname(p, doc, ci->num);
                return Efallthrough;
index afd06453deccdc669c1568f7ece5fcf57c178d65..c226d432b0175880f799c031951fd410e91fe936 100644 (file)
@@ -481,7 +481,7 @@ DEF_CMD(mp_add)
                change_part(mpi, ci->mark, n, 0);
 
        pane_add_notify(ci->home, ci->focus, "Notify:Close");
-       home_call(ci->focus, "Request:Notify:doc:viewers", ci->home);
+       home_call(ci->focus, "doc:Request:Notify:doc:viewers", ci->home);
 
        return 1;
 }
index 873dac4553f4dd2a71ffe0863272c587a4135f78..5cb2d20e4360cd35a22f50eaa2d6fb50bfa90c9b 100644 (file)
@@ -305,7 +305,7 @@ DEF_CMD(text_load_file)
                }
        }
        t->saved = t->undo;
-       call("Call:Notify:doc:status-changed", ci->home);
+       call("doc:Notify:doc:status-changed", ci->home);
        pane_notify("Notify:doc:Replace", t->doc.home);
        if (fd != ci->num2)
                close(fd);
@@ -497,7 +497,7 @@ DEF_CMD(text_save_file)
        call("Message", ci->focus, 0, NULL, msg);
        free(msg);
        if (change_status)
-               call("Call:Notify:doc:status-changed", d->home);
+               call("doc:Notify:doc:status-changed", d->home);
        text_check_autosave(t);
        if (ret == 0)
                return 1;
@@ -1169,7 +1169,7 @@ DEF_CMD(text_reundo)
        text_check_consistent(t);
 
        if (status != (t->undo == t->saved))
-               call("Call:Notify:doc:status-changed", t->doc.home);
+               call("doc:Notify:doc:status-changed", t->doc.home);
        text_check_autosave(t);
 
        /* Point probably moved, so */
@@ -1870,7 +1870,7 @@ DEF_CMD(text_replace)
        }
        text_check_autosave(t);
        if (status_change)
-               call("Call:Notify:doc:status-changed", d->home);
+               call("doc:Notify:doc:status-changed", d->home);
        pane_notify("Notify:doc:Replace", t->doc.home, 0, pm, NULL,
                    0, early);
        if (!ci->mark2)
@@ -2003,7 +2003,7 @@ DEF_CMD(text_modified)
        else
                t->saved = t->undo;
        text_check_autosave(t);
-       call("Call:Notify:doc:status-changed", d->home);
+       call("doc:Notify:doc:status-changed", d->home);
        return 1;
 }
 
index 466e49dac10706e712b416f5823d8838f5f493e0..20b339674fe0369a73960bdb61b24ca3a9689aad 100644 (file)
@@ -364,7 +364,7 @@ DEF_CMD(search_toggle_ci)
        if (ci->mark && doc_following_pane(ci->focus, ci->mark) != WEOF)
                return 0;
        esi->case_sensitive = !esi->case_sensitive;
-       call("Call:Notify:doc:Replace", ci->focus);
+       call("doc:Notify:doc:Replace", ci->focus);
        attr_set_str(&ci->home->attrs, "status-line",
                     esi->case_sensitive ? " Search: case sensitive " :
                     " Search: case insensitive ");
@@ -419,7 +419,7 @@ DEF_CMD(emacs_search)
 
        p = pane_register(ci->focus, 0, &search_handle.c, esi, NULL);
        if (p) {
-               call("Request:Notify:doc:Replace", p);
+               call("doc:Request:Notify:doc:Replace", p);
                attr_set_str(&p->attrs, "status-line", " Search: case insensitive ");
                comm_call(ci->comm2, "callback:attach", p);
        }
index f729b2de79844c9b560d74f742e4c937dd18603f..101f4415dccd499c769a2b267a397958c1bf6279 100644 (file)
@@ -169,7 +169,7 @@ DEF_CMD(history_attach)
        buf_init(&hi->search);
        p = pane_register(ci->focus, 0, &hi->handle.c, hi, NULL);
        pane_add_notify(p, hi->history, "Notify:Close");
-       call("Request:Notify:doc:Replace", p);
+       call("doc:Request:Notify:doc:Replace", p);
        return comm_call(ci->comm2, "callback:attach", p);
 }
 
index b07b465baf6475f47a73dd5761522b3a873e94a8..e49655f031307d29902c3716cb38aef989839a0a 100644 (file)
@@ -300,7 +300,7 @@ DEF_CMD(linecount_clip)
 DEF_CMD(count_lines)
 {
        /* FIXME optimise this away most of the time */
-       if (call("Call:Notify:doc:CountLines", ci->focus) == 0) {
+       if (call("doc:Notify:doc:CountLines", ci->focus) == 0) {
                /* No counter in place, add one */
                struct count_info *cli;
                struct pane *p;
@@ -308,22 +308,22 @@ DEF_CMD(count_lines)
                cli = calloc(1, sizeof(*cli));
                p = pane_register(NULL, 0, &handle_count_lines.c, cli, NULL);
                cli->view_num = home_call(ci->focus, "doc:add-view", p) - 1;
-               home_call(ci->focus, "Request:Notify:doc:Replace", p);
-               home_call(ci->focus, "Request:Notify:doc:CountLines", p);
-               home_call(ci->focus, "Request:Notify:doc:GotoLine", p);
-               call("Call:Notify:doc:CountLines", ci->focus, 1, ci->mark);
+               home_call(ci->focus, "doc:Request:Notify:doc:Replace", p);
+               home_call(ci->focus, "doc:Request:Notify:doc:CountLines", p);
+               home_call(ci->focus, "doc:Request:Notify:doc:GotoLine", p);
+               call("doc:Notify:doc:CountLines", ci->focus, 1, ci->mark);
        }
        if (ci->mark) {
                if (ci->str && strcmp(ci->str, "goto:line") == 0 &&
                    ci->num != NO_NUMERIC) {
-                       call("Call:Notify:doc:GotoLine", ci->focus, ci->num, NULL, NULL,
+                       call("doc:Notify:doc:GotoLine", ci->focus, ci->num, NULL, NULL,
                             0, ci->mark);
                }
-               call("Call:Notify:doc:CountLines", ci->focus, 0, NULL, NULL,
+               call("doc:Notify:doc:CountLines", ci->focus, 0, NULL, NULL,
                     0, ci->mark);
        }
        if (ci->mark2)
-               call("Call:Notify:doc:CountLines", ci->focus, 0, NULL, NULL,
+               call("doc:Notify:doc:CountLines", ci->focus, 0, NULL, NULL,
                      0, ci->mark2);
        return 1;
 }
index d45e402c6df9d3659a7da5c12e5c4c843c1418fb..d657aff5f609d5e2c2d4c532778f5cef3ce4e9a4 100644 (file)
@@ -382,7 +382,7 @@ static struct pane *safe do_view_attach(struct pane *par, int border)
        p = pane_register(par, 0, &view_handle.c, vd, NULL);
        /* Capture status-changed notification so we can update 'changed' flag in
         * status line */
-       call("Request:Notify:doc:status-changed", p);
+       call("doc:Request:Notify:doc:status-changed", p);
        pane_damaged(p, DAMAGED_SIZE);
        return p;
 }
index 88c13c90c361d7b42a4106c2e958614222691a73..ff25a97d523598a318d91dbcb5b15871ef2f0b35 100755 (executable)
@@ -68,8 +68,8 @@ try:
                                        else:
                                                self.sock.send("No Display!")
                                        return 1
-                               if msg[:24] == "Request:Notify:doc:done:":
-                                       path = msg[24:]
+                               if msg[:28] == "doc:Request:Notify:doc:done:":
+                                       path = msg[28:]
                                        d = editor.call("doc:open", -1, path, ret="focus")
                                        if not d:
                                                self.sock.send("FAIL")
@@ -189,7 +189,7 @@ if is_client:
                if ret != "OK":
                        print "Cannot open: ", ret
                        sys.exit(1)
-               s.send("Request:Notify:doc:done:"+file)
+               s.send("doc:Request:Notify:doc:done:"+file)
         else:
                 s.send("Request:Notify:Close")
         ret = s.recv(100)
@@ -212,7 +212,7 @@ else:
                ServerPane(new)
 
        def server_done(key, focus, **a):
-               ret = focus.call("Call:Notify:doc:done", "test")
+               ret = focus.call("doc:Notify:doc:done", "test")
                if ret > 0:
                        # maybe save, then notify properly
                        fn = focus["filename"]
@@ -220,7 +220,7 @@ else:
                        if fn and mod == "yes":
                                focus.call("Message", "Please save first!")
                        else:
-                               focus.call("Call:Notify:doc:done")
+                               focus.call("doc:Notify:doc:done")
                                # FIXME need something better than 'bury'
                                # If it was already visible, it should stay that way
                                focus.call("Window:bury")
index 39f2c0d2e447b0ae435bd3ad6e5282057733f65f..fb6b99b19d902a1cc8427da99ab14315de7e2676 100644 (file)
@@ -826,7 +826,7 @@ class notmuch_main_view(edlib.Pane):
         self['background'] = 'color:#A0FFFF'
         self['line-format'] = '<%fmt>%count %+name</>'
         self.call("notmuch:set_list_pane")
-        self.call("Request:Notify:doc:Replace")
+        self.call("doc:Request:Notify:doc:Replace")
         self.selected = None
 
     def handle_clone(self, key, focus, **a):
@@ -1355,7 +1355,7 @@ class notmuch_query_view(edlib.Pane):
         self.thread_start = None
         self.thread_end = None
         self.thread_matched = None
-        self.call("Request:Notify:doc:Replace")
+        self.call("doc:Request:Notify:doc:Replace")
 
     def handle_clone(self, key, focus, mark, mark2, num, num2, str, comm2, **a):
         "handle:Clone"
index 7c7d1428c673e88008a290a76be9952991714b02..ababdb2bf1e5328135023c626d5e5ed1dd7fc0f3 100644 (file)
@@ -709,20 +709,20 @@ class MarkdownPane(edlib.Pane):
         "handle:Display:refresh"
         # Refresh causes presentation page to recenter
         # page-down just moves down to start of next page.
-        focus.call("Call:Notify:doc:Recentre", mark)
+        focus.call("doc:Notify:doc:Recentre", mark)
         return 0
 
     def handle_mvl(self, key, focus, mark, num, **a):
         "handle:Move-View-Large"
         if num >= 0 and mark:
             m2 = mark.dup()
-            if focus.call("Call:Notify:doc:Recentre", m2, 2,
+            if focus.call("doc:Notify:doc:Recentre", m2, 2,
                           lambda key, **a: mark.to_mark(a['mark'])) > 0:
                 focus.damaged(edlib.DAMAGED_CURSOR)
                 return 1
         if num < 0 and mark:
             m2 = mark.dup()
-            if focus.call("Call:Notify:doc:Recentre", m2, 3,
+            if focus.call("doc:Notify:doc:Recentre", m2, 3,
                           lambda key, **a: mark.to_mark(a['mark'])) > 0:
                 focus.damaged(edlib.DAMAGED_CURSOR)
                 return 1
@@ -734,8 +734,8 @@ def present_attach(key, focus, comm2, **a):
     p['background'] = 'color:yellow'
     p['hide-cursor'] = 'yes'
 
-    p.call("Request:Notify:doc:Replace")
-    p.call("Request:Notify:doc:Recentre")
+    p.call("doc:Request:Notify:doc:Replace")
+    p.call("doc:Request:Notify:doc:Recentre")
     comm2("callback", p)
     return 1
 
index 43695f9ca532c8fa7dc2c4822a3ac3bb1e85a42c..57871bf0075f4d696eb4708cf0c23492f03ad9c8 100644 (file)
@@ -221,7 +221,7 @@ static struct pane *do_render_hex_attach(struct pane *parent safe)
                render_hex_register_map();
 
        p = pane_register(parent, 0, &render_hex_handle.c, he, NULL);
-       call("Request:Notify:doc:Replace", p);
+       call("doc:Request:Notify:doc:Replace", p);
        attr_set_str(&p->attrs, "render-wrap", "no");
        attr_set_str(&p->attrs, "heading", "<bold>          00 11 22 33 44 55 66 77  88 99 aa bb cc dd ee ff   0 1 2 3 4 5 6 7  8 9 a b c d e f</>");
        he->pane = p;
index f431988ce4e78cd8342166a5b5a089fc405d9ec3..e66c9bdfa085271fa8ac4cd23a91351d02d52d9e 100644 (file)
@@ -1820,7 +1820,7 @@ REDEF_CMD(render_lines_attach)
                p = call_ret(pane, "attach-renderline", p);
        p = pane_register(p, 0, &render_lines_handle.c, rl, NULL);
        rl->typenum = home_call(ci->focus, "doc:add-view", p) - 1;
-       call("Request:Notify:doc:Replace", p);
+       call("doc:Request:Notify:doc:Replace", p);
 
        return comm_call(ci->comm2, "callback:attach", p);
 }