[PATCH] Add TAGS to .gitignore

View: New views
7 Messages — Rating Filter:   Alert me  

[PATCH] Add TAGS to .gitignore

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2f3bbab..78b2019 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 /conkeror.xulapp
 #*#
 .#*
+TAGS
 xulrunner-stub
 conkeror-spawn-helper
 conkeror
--
1.6.2.4

_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

[PATCH] Show errors from completers, etc.

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If an interactive_error was thrown in a minibuffer completer function,
the error was previously lost.  This commit ensures that the error
message is displayed in the minibuffer.

The problem arises because direct uses of co_call do not propagate
exceptions.  The same fix is applied to the two other places in
conkeror that could lose an error message.  One other place, in
download_helper.handle_show, already handled the problem in the same
way.

An alternative fix would be to provide an interactive_co_call to do
the wrappering.
---
 modules/download-manager.js |    2 ++
 modules/help.js             |    8 +++++++-
 modules/minibuffer-read.js  |    2 ++
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/modules/download-manager.js b/modules/download-manager.js
index 1426acf..7d7d9c7 100644
--- a/modules/download-manager.js
+++ b/modules/download-manager.js
@@ -452,6 +452,8 @@ var download_progress_listener = {
                                 yield shell_command_with_argument(info.shell_command,
                                                                   info.target_file.path,
                                                                   $cwd = info.shell_command_cwd);
+                            } catch (e) {
+                                handle_interactive_error(info.source_buffer.window, e);
                             } finally  {
                                 if (info.temporary_status == DOWNLOAD_TEMPORARY_FOR_COMMAND)
                                     if(delete_temporary_files_for_command) {
diff --git a/modules/help.js b/modules/help.js
index be57beb..c6bf106 100644
--- a/modules/help.js
+++ b/modules/help.js
@@ -53,12 +53,18 @@ help_document_generator.prototype = {
     source_code_reference : function(ref, parent) {
         var f = this.document.createDocumentFragment();
         var module_name = ref.module_name;
+        var buffer = this.buffer;
         //f.appendChild(this.text(module_name != null ? "module " : "file "));
         var x = this.element("a",
                              "class", "source-code-reference",
                              "href", "javascript:");
         x.addEventListener("click", function (event) {
-            co_call(ref.open_in_editor());
+            co_call(function () {
+                try {
+                    yield ref.open_in_editor();
+                } catch (e) {
+                    handle_interactive_error(buffer.window, e);
+                }}());
             event.preventDefault();
             event.stopPropagation();
         }, false /* capture */, false /* allow untrusted */);
diff --git a/modules/minibuffer-read.js b/modules/minibuffer-read.js
index 743181f..53ec922 100644
--- a/modules/minibuffer-read.js
+++ b/modules/minibuffer-read.js
@@ -268,6 +268,8 @@ text_entry_minibuffer_state.prototype = {
                 var x;
                 try {
                     x = yield c;
+                } catch (e) {
+                    handle_interactive_error(m.window, e);
                 } finally {
                     s.completions_cont = null;
                     already_done = true;
--
1.6.2.4

_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

[PATCH] Fix editing source from help buffer.

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was probably broken by commit 6c90a66 (load-spec refactoring, 2009-02-03).
---
 modules/utils.js |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/utils.js b/modules/utils.js
index 81f05fe..d7bcf3c 100644
--- a/modules/utils.js
+++ b/modules/utils.js
@@ -394,7 +394,8 @@ source_code_reference.prototype = {
     },
 
     open_in_editor : function() {
-        yield open_with_external_editor(this.best_uri, $line = this.line_number);
+        yield open_with_external_editor(load_spec(this.best_uri),
+                                        $line = this.line_number);
     }
 };
 
--
1.6.2.4

_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

[PATCH] Let completion functions set the match_required state.

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Currently the match_required state is set at the beginning when input
is being read.  This commit allows completers to change that state
during the input.  In particular, this can be used to allow a webjump
with a limited set of valid inputs to prevent invalid inputs from
being accepted.

For example, the following webjump can now be defined and will only
allow valid bookmarks to be chosen.  Without $match_required, the webjump
will try to visit any arbitrary input, which is confusing and not useful.

  /* Access bookmarks via completion from a webjump. */
  define_webjump("bookmark",
                 function(term) {return term;},
                 $completer = history_completer($use_history = false,
                                                $use_bookmarks = true,
                                                $match_required = true));

Another example is in the upcoming index webjump feature.
---

Note: In merge_completers I think the destroy function needs something
like call_all('destroy'), rather than forward().
---
 modules/history.js               |    7 +++++--
 modules/minibuffer-completion.js |   17 +++++++++++++++--
 modules/minibuffer-read.js       |    6 ++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/modules/history.js b/modules/history.js
index 2ca52de..be894d6 100644
--- a/modules/history.js
+++ b/modules/history.js
@@ -9,11 +9,13 @@
 const nav_history_service = Cc["@mozilla.org/browser/nav-history-service;1"]
     .getService(Ci.nsINavHistoryService);
 
-define_keywords("$use_webjumps", "$use_history", "$use_bookmarks");
+define_keywords("$use_webjumps", "$use_history", "$use_bookmarks",
+                "$match_required");
 function history_completer() {
     keywords(arguments);
     var use_history = arguments.$use_history;
     var use_bookmarks = arguments.$use_bookmarks;
+    let match_required = arguments.$match_required;
     return function (input, pos, conservative) {
         if (conservative && input.length == 0)
             return null;
@@ -36,7 +38,8 @@ function history_completer() {
                 get_string: function (i) root.getChild(i).uri,
                 get_description: function (i) root.getChild(i).title,
                 get_input_state: function (i) [root.getChild(i).uri],
-                destroy: function () { root.containerOpen = false; }
+                destroy: function () { root.containerOpen = false; },
+                get_match_required: function() match_required
                };
     }
 }
diff --git a/modules/minibuffer-completion.js b/modules/minibuffer-completion.js
index 503a09e..25cdebf 100644
--- a/modules/minibuffer-completion.js
+++ b/modules/minibuffer-completion.js
@@ -266,7 +266,7 @@ function merge_completers(completers) {
         var count = 0;
         for (let i = 0; i < completers.length; ++i) {
             let r = yield completers[i](input, pos, conservative);
-            if (r != null && r.count > 0) {
+            if (r != null && (r.count > 0 || "get_match_required" in r)) {
                 results.push(r);
                 count += r.count;
             }
@@ -288,11 +288,24 @@ function merge_completers(completers) {
                 return null;
             }
         }
+        function combine_or(name) {
+            return function() {
+                var b = false;
+                for (var j=0; j < results.length; j++) {
+                    var r = results[j];
+                    if (name in r && r[name] != null) {
+                        b = b || r[name].apply(this, arguments);
+                    }
+                }
+                return b;
+            }
+        }
         yield co_return({count: count,
                          get_string: forward('get_string'),
                          get_description: forward('get_description'),
                          get_input_state: forward('get_input_state'),
-                         destroy: forward('destroy')
+                         destroy: forward('destroy'),
+                         get_match_required: combine_or('get_match_required')
                         });
     };
 }
diff --git a/modules/minibuffer-read.js b/modules/minibuffer-read.js
index 53ec922..d72d9c0 100644
--- a/modules/minibuffer-read.js
+++ b/modules/minibuffer-read.js
@@ -78,6 +78,7 @@ function text_entry_minibuffer_state(continuation) {
         this.completions_display_element = null;
         this.selected_completion_index = -1;
         this.match_required  = !!arguments.$match_required;
+        this.match_required_default = this.match_required;
         if (this.match_required)
             this.default_completion = arguments.$default_completion;
     }
@@ -297,6 +298,11 @@ text_entry_minibuffer_state.prototype = {
         this.completions_valid = true;
         this.applied_common_prefix = false;
 
+        if (c && ("get_match_required" in c))
+            this.match_required = c.get_match_required();
+        if (this.match_required == null)
+            this.match_required = this.match_required_default;
+        
         let i = -1;
         if (c && c.count > 0) {
             if (this.match_required) {
--
1.6.2.4

_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

Re: [PATCH] Show errors from completers, etc.

by Jeremy Maitin-Shepard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Kettler <kettler@...> writes:

> If an interactive_error was thrown in a minibuffer completer function,
> the error was previously lost.  This commit ensures that the error
> message is displayed in the minibuffer.

> The problem arises because direct uses of co_call do not propagate
> exceptions.  The same fix is applied to the two other places in
> conkeror that could lose an error message.  One other place, in
> download_helper.handle_show, already handled the problem in the same
> way.

> An alternative fix would be to provide an interactive_co_call to do
> the wrappering.

I'll take a closer look at this patch later today when I have more time.
In some with regard to completions I had specifically intended that an
exception being thrown would just result in no completions being
generated.

--
Jeremy Maitin-Shepard
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

Re: [PATCH] Let completion functions set the match_required state.

by Jeremy Maitin-Shepard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Kettler <kettler@...> writes:

> Currently the match_required state is set at the beginning when input
> is being read.  This commit allows completers to change that state
> during the input.  In particular, this can be used to allow a webjump
> with a limited set of valid inputs to prevent invalid inputs from
> being accepted.

I'll also take a closer look at this patch later today.

--
Jeremy Maitin-Shepard
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror

Re: [PATCH] Show errors from completers, etc.

by David Kettler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[I responded to Jeremy previously, but omitted the list.]

Jeremy Maitin-Shepard wrote:
 > In some with regard to completions I had specifically intended that an
 > exception being thrown would just result in no completions being
 > generated.

I wanted this behaviour for the xpath index webjumps (see the later
patch).  In that case they're not useful without the completion data,
which must be separately downloaded, so I thought the error message
being displayed was more important in that case.

Note that this patch just displays the error; it doesn't terminate the
minibuffer read and the result is still just that there are no
completions.

regards, David.
_______________________________________________
Conkeror mailing list
Conkeror@...
https://www.mozdev.org/mailman/listinfo/conkeror