Răsfoiți Sursa

fixed some issued with the additional ivy actions and macros that are used to
create them.

Boris Glavic 5 ani în urmă
părinte
comite
1f1646feaf
1 a modificat fișierele cu 12 adăugiri și 4 ștergeri
  1. 12 4
      xwwp-follow-link-ivy.el

+ 12 - 4
xwwp-follow-link-ivy.el

@@ -62,7 +62,17 @@
 
 
 (defmacro xwwp-follow-link-ivy-ivify-action (v &rest body)
 (defmacro xwwp-follow-link-ivy-ivify-action (v &rest body)
   "Wraps BODY as an action for the `xwwp-follow-link-read' `ivy' version.
   "Wraps BODY as an action for the `xwwp-follow-link-read' `ivy' version.
-The text and url of the link is made available through variables `linktext' and
+The url of the link is made available as variable `linkurl' extracted from the
+selection candidate V.  Before the action is executed, the link highlights are
+removed from the HTML document shown in xwidgets."
+  `(let ((xwidget (xwidget-webkit-current-session))
+         (linkurl (caddr ,v)))
+    (xwwp-follow-link-cleanup xwidget)
+    ,@body))
+
+(defmacro xwwp-follow-link-ivy-ivify-action-with-text (v &rest body)
+  "Wraps BODY as an action for the `xwwp-follow-link-read' `ivy' version.
+The text and url of the link is made available as variables `linktext' and
 `linkurl' extracted from the selection candidate V.  Before the action is
 `linkurl' extracted from the selection candidate V.  Before the action is
 executed, the link highlights are removed from the HTML document shown in
 executed, the link highlights are removed from the HTML document shown in
 xwidgets."
 xwidgets."
@@ -70,18 +80,16 @@ xwidgets."
          (linktext (car ,v))
          (linktext (car ,v))
          (linkurl (caddr ,v)))
          (linkurl (caddr ,v)))
     (xwwp-follow-link-cleanup xwidget)
     (xwwp-follow-link-cleanup xwidget)
-    ,body))
+    ,@body))
 
 
 (defun xwwp-follow-link-ivy-copy-url-action (v)
 (defun xwwp-follow-link-ivy-copy-url-action (v)
   "Copy the selected url from candidate V to the `kill-ring'."
   "Copy the selected url from candidate V to the `kill-ring'."
   (xwwp-follow-link-ivy-ivify-action v
   (xwwp-follow-link-ivy-ivify-action v
-   (ignore 'linktext)
    (kill-new linkurl)))
    (kill-new linkurl)))
 
 
 (defun xwwp-follow-link-ivy-browse-external-action (v)
 (defun xwwp-follow-link-ivy-browse-external-action (v)
   "Open the selected url from candidate V in the default browser."
   "Open the selected url from candidate V in the default browser."
   (xwwp-follow-link-ivy-ivify-action v
   (xwwp-follow-link-ivy-ivify-action v
-   (ignore 'linktext)
    (browse-url linkurl)))
    (browse-url linkurl)))
 
 
 (defun xwwp-follow-link-ivy-get-full-candidate (c)
 (defun xwwp-follow-link-ivy-get-full-candidate (c)