emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda filter by any tag seems to be broken
@ 2016-05-13  3:30 Eric Abrahamsen
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-13  3:30 UTC (permalink / raw)
  To: emacs-orgmode

Apparently there's some networking devilry going on with gmane at the
moment, and this never got sent -- I'm trying again. Original message
was:



Is anyone else seeing this?

Go into a tags-type agenda, hit "/" to start filtering, then SPC for
"filter to any tag". That gives me this backtrace:

Debugger entered--Lisp error: (args-out-of-range "" 0 1)
  substring("" 0 1)
  (equal "{" (substring tag 0 1))
  (and (equal "{" (substring tag 0 1)) (equal "}" (substring tag -1)))

  org-agenda-filter-make-matcher-tag-exp(("+") 43)

Once ("+") is added to `org-agenda-tag-filter', all subsequent filtering
actions will fail, until you remove all filters with "/ /".

`org-agenda-filter-make-matcher-tag-exp' always removes the first
character of the tag-matcher string, and then operates on what's left.
In the case of "+", nothing's left!

Thanks,
Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Agenda filter by any tag seems to be broken
@ 2016-05-13  3:30 Eric Abrahamsen
  2016-05-16 18:28 ` Kaushal Modi
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-13  3:30 UTC (permalink / raw)
  To: emacs-orgmode

Is anyone else seeing this?

Go into a tags-type agenda, hit "/" to start filtering, then SPC for
"filter to any tag". That gives me this backtrace:

Debugger entered--Lisp error: (args-out-of-range "" 0 1)
  substring("" 0 1)
  (equal "{" (substring tag 0 1))
  (and (equal "{" (substring tag 0 1)) (equal "}" (substring tag -1)))

  org-agenda-filter-make-matcher-tag-exp(("+") 43)

Once ("+") is added to `org-agenda-tag-filter', all subsequent filtering
actions will fail, until you remove all filters with "/ /".

`org-agenda-filter-make-matcher-tag-exp' always removes the first
character of the tag-matcher string, and then operates on what's left.
In the case of "+", nothing's left!

Thanks,
Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-13  3:30 Eric Abrahamsen
@ 2016-05-16 18:28 ` Kaushal Modi
  2016-05-17  0:37   ` Eric Abrahamsen
  2016-05-17  2:00   ` Eric Abrahamsen
  0 siblings, 2 replies; 9+ messages in thread
From: Kaushal Modi @ 2016-05-16 18:28 UTC (permalink / raw)
  To: Eric Abrahamsen, emacs-orgmode

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

On Mon, May 16, 2016 at 1:50 PM Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Is anyone else seeing this?
>
> Go into a tags-type agenda, hit "/" to start filtering, then SPC for
> "filter to any tag". That gives me this backtrace:
>

Can you add more detail on how to recreate the problem you are seeing in an
emacs -Q session.

I do not use tag filtering heavily, so "tags-type agenda" is not clear to
me.

I tried M-x org-agenda, followed by m, followed by / and then SPC. But I do
not see that error.
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 931 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-16 18:28 ` Kaushal Modi
@ 2016-05-17  0:37   ` Eric Abrahamsen
  2016-05-17 19:40     ` Kaushal Modi
  2016-05-17  2:00   ` Eric Abrahamsen
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-17  0:37 UTC (permalink / raw)
  To: emacs-orgmode

Kaushal Modi <kaushal.modi@gmail.com> writes:

> On Mon, May 16, 2016 at 1:50 PM Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote:
>
>     Is anyone else seeing this?
>
>     Go into a tags-type agenda, hit "/" to start filtering, then SPC
>     for
>     "filter to any tag". That gives me this backtrace:
>
> Can you add more detail on how to recreate the problem you are seeing
> in an emacs -Q session.
>
> I do not use tag filtering heavily, so "tags-type agenda" is not clear
> to me.
>
> I tried M-x org-agenda, followed by m, followed by / and then SPC. But
> I do not see that error.
> -- 

Starting with emacs -Q, then adding the org-plus-contrib directory to
load-path:

M-x org-agenda
t ;; all todos, an empty list of course
/
SPC

And I get the error.

I have a mostly-baseless hunch that the reason I seem to get more
mysterious errors than other people is that I'm running emacs master
from git, and emacs master forces more lexical scoping stuff than
previous versions. I'm mostly pulling that out of nowhere, but there
must be other people on the list who are running emacs git, and I'd be
curious to know if they see the same error...

Thanks!
Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-16 18:28 ` Kaushal Modi
  2016-05-17  0:37   ` Eric Abrahamsen
@ 2016-05-17  2:00   ` Eric Abrahamsen
  1 sibling, 0 replies; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-17  2:00 UTC (permalink / raw)
  To: emacs-orgmode

Kaushal Modi <kaushal.modi@gmail.com> writes:

> On Mon, May 16, 2016 at 1:50 PM Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote:
>
>     Is anyone else seeing this?
>
>     Go into a tags-type agenda, hit "/" to start filtering, then SPC
>     for
>     "filter to any tag". That gives me this backtrace:
>
> Can you add more detail on how to recreate the problem you are seeing
> in an emacs -Q session.
>
> I do not use tag filtering heavily, so "tags-type agenda" is not clear
> to me.
>
> I tried M-x org-agenda, followed by m, followed by / and then SPC. But
> I do not see that error.
> -- 

Also, if you're willing to spend a moment on this, would you start the
agenda with the "t" key, then edebug the function
`org-agenda-filter-make-matcher-tag-exp', then do the "/ SPC" thing, and
tell me what arguments the function receives?

Thank you!
Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-17  0:37   ` Eric Abrahamsen
@ 2016-05-17 19:40     ` Kaushal Modi
  2016-05-18  3:31       ` Eric Abrahamsen
  0 siblings, 1 reply; 9+ messages in thread
From: Kaushal Modi @ 2016-05-17 19:40 UTC (permalink / raw)
  To: Eric Abrahamsen, emacs-orgmode

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

On Mon, May 16, 2016 at 8:38 PM Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Starting with emacs -Q, then adding the org-plus-contrib directory to
> load-path:
>

Are you installing both the git master version and org-plus-contrib? I do
not have org-plus-contrib in my load-path. The only org I have in the
load-path is the git master version. If you *are* installing both versions,
then that could probably explain the issue you are facing.


> M-x org-agenda
> t ;; all todos, an empty list of course
> /
> SPC
>
> And I get the error.
>

I tried that. But I don't get any error.

I took the original org-agenda-filter-make-matcher-tag-exp function from
the git master and added few debug statements as below:

(defun org-agenda-filter-make-matcher-tag-exp (tags op)
  "Return a form associated to tag-expression TAGS.
Build a form testing a line for agenda filter for
tag-expressions.  OP is an operator of type CHAR that allows the
function to set the right switches in the returned form."
  (message "arg tags: %S" tags)
  (message "arg op: %S" op)
  (let (form ret)
    ;; Any of the expressions can match if OP is +, all must match if
    ;; the operator is -.
    (dolist (x tags (cons (if (eq op ?-) 'and 'or) form))
      (let* ((tag (substring x 1))
             (f (cond
((string= "" tag) '(not tags))
((and (string-match-p "\\`{" tag) (string-match-p "}\\'" tag))
 ;; TAG is a regexp.
 (list 'org-match-any-p (substring tag 1 -1) 'tags))
(t (list 'member (downcase tag) 'tags)))))
        (message "in let, tag: %S" tag)
        (message "in let, f: %S" f)
(prog1
            (setq ret (push (if (eq op ?-) (list 'not f) f) form))
          (message "ret val: %S" ret))))))

Then when I do M-x org-agenda t / SPC, I get:

arg tags: ("+")
arg op: 43
in let, tag: ""
in let, f: (not tags)
ret val: ((not tags))

-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3311 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-17 19:40     ` Kaushal Modi
@ 2016-05-18  3:31       ` Eric Abrahamsen
  2016-05-19  8:38         ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-18  3:31 UTC (permalink / raw)
  To: emacs-orgmode

Kaushal Modi <kaushal.modi@gmail.com> writes:

> On Mon, May 16, 2016 at 8:38 PM Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote:
>
>     Starting with emacs -Q, then adding the org-plus-contrib directory
>     to
>     load-path:
>
> Are you installing both the git master version and org-plus-contrib? I
> do not have org-plus-contrib in my load-path. The only org I have in
> the load-path is the git master version. If you *are* installing both
> versions, then that could probably explain the issue you are facing.

I'm not running org from git anymore, just org-plus-contrib from...
melpa? Actually, since Emacs' package management has no way of
specifying "provides", I've got both org and org-plus-contrib. But
that's not the issue, see below...

>     M-x org-agenda
>     t ;; all todos, an empty list of course
>     /
>     SPC
>
>     And I get the error.
>
> I tried that. But I don't get any error.
>
> I took the original org-agenda-filter-make-matcher-tag-exp function
> from the git master and added few debug statements as below:
>
> (defun org-agenda-filter-make-matcher-tag-exp (tags op)
>   "Return a form associated to tag-expression TAGS.
> Build a form testing a line for agenda filter for
> tag-expressions.  OP is an operator of type CHAR that allows the
> function to set the right switches in the returned form."
>   (message "arg tags: %S" tags)
>   (message "arg op: %S" op)
>   (let (form ret)
>     ;; Any of the expressions can match if OP is +, all must match if
>     ;; the operator is -.
>     (dolist (x tags (cons (if (eq op ?-) 'and 'or) form)) 
>       (let* ((tag (substring x 1))
>              (f (cond
> ((string= "" tag) '(not tags))
> ((and (string-match-p "\\`{" tag) (string-match-p "}\\'" tag))

Okay, there's the problem. In the org git repo, the code above has been
that way since it was added in 2015. In the package-manager version,
however, it now looks like this:

      (let* ((tag (substring x 1))
	     (isregexp (and (equal "{" (substring tag 0 1))
			    (equal "}" (substring tag -1))))
	     regexp)

And the `substring' calls raise the error. The code is the same in the
"org" and "org-plus-contrib" packages.

I don't know where the different code comes from, or who maintains it,
or why it's different from the org git repo, but it would be nice if
someone could look into fixing that!

Eric

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-18  3:31       ` Eric Abrahamsen
@ 2016-05-19  8:38         ` Nicolas Goaziou
  2016-05-19 13:46           ` Eric Abrahamsen
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2016-05-19  8:38 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Hello,

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Okay, there's the problem. In the org git repo, the code above has been
> that way since it was added in 2015. In the package-manager version,
> however, it now looks like this:
>
>       (let* ((tag (substring x 1))
> 	     (isregexp (and (equal "{" (substring tag 0 1))
> 			    (equal "}" (substring tag -1))))
> 	     regexp)
>
> And the `substring' calls raise the error. The code is the same in the
> "org" and "org-plus-contrib" packages.
>
> I don't know where the different code comes from, or who maintains it,
> or why it's different from the org git repo, but it would be nice if
> someone could look into fixing that!

Fixed. Thank you for the detailed report.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Agenda filter by any tag seems to be broken
  2016-05-19  8:38         ` Nicolas Goaziou
@ 2016-05-19 13:46           ` Eric Abrahamsen
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Abrahamsen @ 2016-05-19 13:46 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Okay, there's the problem. In the org git repo, the code above has been
>> that way since it was added in 2015. In the package-manager version,
>> however, it now looks like this:
>>
>>       (let* ((tag (substring x 1))
>> 	     (isregexp (and (equal "{" (substring tag 0 1))
>> 			    (equal "}" (substring tag -1))))
>> 	     regexp)
>>
>> And the `substring' calls raise the error. The code is the same in the
>> "org" and "org-plus-contrib" packages.
>>
>> I don't know where the different code comes from, or who maintains it,
>> or why it's different from the org git repo, but it would be nice if
>> someone could look into fixing that!
>
> Fixed. Thank you for the detailed report.

Great, thanks a lot!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-19 13:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-13  3:30 Agenda filter by any tag seems to be broken Eric Abrahamsen
  -- strict thread matches above, loose matches on Subject: below --
2016-05-13  3:30 Eric Abrahamsen
2016-05-16 18:28 ` Kaushal Modi
2016-05-17  0:37   ` Eric Abrahamsen
2016-05-17 19:40     ` Kaushal Modi
2016-05-18  3:31       ` Eric Abrahamsen
2016-05-19  8:38         ` Nicolas Goaziou
2016-05-19 13:46           ` Eric Abrahamsen
2016-05-17  2:00   ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).