zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Freyermuth <o.freyermuth@googlemail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org
Subject: Re: zathura conpletion for zsh broken
Date: Tue, 25 Sep 2018 23:22:22 +0200	[thread overview]
Message-ID: <e6938da8-fdc5-834c-df60-b872655139b2@googlemail.com> (raw)
In-Reply-To: <1537907787.166425.1520521784.2C5972A6@webmail.messagingengine.com>

[-- Attachment #1: Type: text/plain, Size: 2357 bytes --]

Am 25.09.18 um 22:36 schrieb Daniel Shahaf:
> Oliver Freyermuth wrote on Tue, 25 Sep 2018 22:02 +0200:
>> Am 25.09.18 um 21:21 schrieb Daniel Shahaf:
>>> Oliver Freyermuth wrote on Tue, Sep 25, 2018 at 17:14:04 +0200:
>>>> +++ b/Completion/X/Command/_zathura
>>>> @@ -25,7 +25,7 @@ _zathura_files(){
>>>> -      supported_filetypes+="${${pf%.so}#${plugins_dir}/lib}"
>>>> +      supported_filetypes+="${${pf%.so}#${plugins_dir}/}"
>>>
>>> Isn't this equivalent to «supported_filetypes+=${pf:t:r}»?
>>
>> Indeed, it is, and that would be much easier. 
> 
> Pushed.  I changed the log message to avoid mentioning implementation
> terms (the variable's name) in ChangeLog, which is user-facing.

Thanks! Didn't know this is copied as-is, I'll take better care
in the future. Hopefully the commit message of the attached patch is better. 

>>> The 'break' on line 12 looks odd.  Does zathura really ignore
>>> /usr/lib/zathura/foo.so if /usr/local/lib/zathura/bar.so exists and
>>> /usr/local/lib/zathura/foo.so does not?
>>
>> You are correct in spotting this, if I read the zathura code correctly
>> (not a girara expert...), it "does the right thing" and searches the
>> full list of paths.
>>
>> I'll try to cook up a patch fixing both those issues. Might take a
>> while though, since I'm just starting with this (basically I started
>> to investigate after "zathura <tab>" stopped doing anything after a
>> zsh upgrade, makinɡ usage rather cumbersome).
> 
> Thanks for the patch and looking into the additional issue.

The attached patch fixes the second issue, I tested with a dummy .so
in /usr/local/lib/zathura. Plugin file formats are now also made unique. 
Let me know if this can be simplified, or if it is in any case unneeded since the "uniqueness"
is implicit in the matching code later on - I'm still learning more and more about the wonders of zsh expansion,
and every bit I learn leaves me wondering how I could ever survive without that knowledge up to now. 

Cheers,
Oliver

> P.S. Our of curiosity, what's that U+0261 LATIN SMALL LETTER SCRIPT G doing there?
Spotted very well, my font and mail client hid that from me. 
I did accidentally hit the keybinding for SCIM (Smart Common Input Method) while typing,
and it started to interfere. That created some funny characters, and apparently I missed to remove the
"g" once I noticed it. 

[-- Attachment #2: 0001-Fix-zathura-completion-ignoring-multiple-plugin-dire.patch --]
[-- Type: text/x-patch, Size: 1082 bytes --]

From 3d95608365dfc165c7a77bd3caad69b66b09f97b Mon Sep 17 00:00:00 2001
From: Oliver Freyermuth <o.freyermuth@googlemail.com>
Date: Tue, 25 Sep 2018 23:08:33 +0200
Subject: [PATCH] Fix zathura completion ignoring multiple plugin directories.

---
 Completion/X/Command/_zathura | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Completion/X/Command/_zathura b/Completion/X/Command/_zathura
index 64888d013..5335c1143 100644
--- a/Completion/X/Command/_zathura
+++ b/Completion/X/Command/_zathura
@@ -8,8 +8,7 @@ _zathura_files(){
     ${(Qv)opt_args[(i)-p|--plugins-dir]}(#qN) \
     {/usr/local,/usr,}/lib/zathura(#qN)
   do
-    plugins_files=( $plugins_dir/*.so )
-    (( $#plugins_files )) && break
+    plugins_files+=( $plugins_dir/*.so )
   done
   if [[ -z "${plugins_files}" ]]; then
     _files -g "*.pdf(-.)"
@@ -28,7 +27,7 @@ _zathura_files(){
       supported_filetypes+="${pf:t:r}"
     fi
   done
-  _files -g "*.(${(j.|.)supported_filetypes})(-.)"
+  _files -g "*.(${(j.|.)${(@u)supported_filetypes}})(-.)"
 }
 
 _arguments -s -S \
-- 
2.16.4


  reply	other threads:[~2018-09-25 21:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 15:14 Oliver Freyermuth
2018-09-25 19:21 ` Daniel Shahaf
2018-09-25 20:02   ` Oliver Freyermuth
2018-09-25 20:36     ` Daniel Shahaf
2018-09-25 21:22       ` Oliver Freyermuth [this message]
2018-09-25 22:56         ` Daniel Shahaf
2018-09-26  2:22           ` Oliver Freyermuth
2018-09-26 21:08     ` Leah Neukirchen
2018-09-27 18:20       ` Daniel Shahaf
2018-09-27 18:31         ` Bart Schaefer
2018-09-27 19:16           ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6938da8-fdc5-834c-df60-b872655139b2@googlemail.com \
    --to=o.freyermuth@googlemail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).