emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Konstantin Kliakhandler <kosta@slumpy.org>
To: emacs-orgmode@gnu.org
Subject: Re: Weird behavior in `org-agenda-redo' and/or `org-mobile-push'
Date: Tue, 6 May 2014 18:54:23 +0300	[thread overview]
Message-ID: <CAH+LVpmAvsbU2UnKe=N+R-OJKnaFSHsRVMtD_Y4+XiJMjGukQQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+LVpmKcR0qNMaSEC4uo92R8NdZj5vhmdgOrAi9C9pk_iB-ZQ@mail.gmail.com>

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

While investigating the previous issue, I came upon this code:

;;;###autoload
(defun org-store-agenda-views (&rest parameters)
  "Store agenda views."
  (interactive)
  (eval (list 'org-batch-store-agenda-views)))

I guess there is some advantage over the following, simpler version?

;;;###autoload
(defun org-store-agenda-views (&rest parameters)
  "Store agenda views."
  (interactive)
  (org-batch-store-agenda-views))

If so, what is it?

Thanks in advance for furthering my education,
Kosta

--
Konstantin Kliakhandler
    http://slumpy.org
          )°) )°( (°(


On Tue, May 6, 2014 at 2:00 PM, Konstantin Kliakhandler <kosta@slumpy.org>wrote:

> Hello,
>
> [This behavior appears in a previous and the following org versions:
> Org-mode version 8.2.6 (8.2.6-14-g063c8b-elpa @
> /home/kosta/.emacs.d/elpa/org-20140505/)]
>
> I recently began seeing weird behavior when trying to run
> `org-mobile-push' in an agenda buffer; It appears the files are indeed
> pushed, but at the end I get an error: "(wrong-type-argument arrayp nil)"
>
> This only happens when I attempt to push from an agenda buffer - if I push
> in a regular org buffer, everything works.
>
> The stack trace is:
> org-agenda-filter-apply(nil category)
> org-agenda-redo()
> org-mobile-push()
>
> where the `org-agenda-filter-apply' call is from this sexp in
> `org-agenda-redo':
> (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter
> 'category))
>
> And cat-filter, cat-preset are set in a let* form higher up in
> org-agenda-redo as (their values are included):
>
> (cat-filter org-agenda-category-filter)
> nil
> (cat-preset (get 'org-agenda-category-filter :preset-filter))
> ("+Academic")
>
> When I start emacs or even look at the agenda,
> (get 'org-agenda-category-filter :preset-filter) always evaluates to nil
> (up to the point where I eval `org-mobile-push'). It gets set in
> `org-mobile-create-sumo-agenda', which is called at some point from
> `org-mobile-push' before `org-agenda-redo'.
>
> Apparently this started happening after I added the following custom
> agenda command:
>
> ("z" "All academic agenda items" alltodo ""
>  ((org-agenda-overriding-header "Academic todos.")
>   (org-agenda-category-filter-preset
>    (quote
> ("+Academic")))
> (org-agenda-todo-list-sublevels nil)))
>
> Now, I have two questions/comments:
> 1. It appears that `org-agenda-filter-apply' expects an array, and an
> array always evaluates to togical t (As far as I remember, have just
> checked). If this is the case, in the following sexp (from
> `org-agenda-filter-apply'): (and (or cat-filter cat-preset)
> (org-agenda-filter-apply cat-filter 'category)) why is the (or cat-filter
> cat-preset)? It seems that either `cat-filter' is an array, in which case
> it is (possibly) valid to pass it to `org-agenda-filter-apply', or is nil,
> in which case it isn't. What role does cat-preset play here?
> 2. It appears to me that `org-mobile-create-sumo-agenda' does not work
> entirely correctly, as it leaves some properties set that were not set
> before it ran?
>
> Ok, so after writing the last two questions, I looked into
> `org-agenda-filter-apply', and it appears that it expects a list of strings
> of the form "+cat" or "-cat", which is what `cat-preset' holds at this
> point.
>
> Changing
> (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter
> 'category))
> to
> (and (or cat-filter cat-preset) (org-agenda-filter-apply (or cat-filter
> cat-preset) 'category))
> as a check and reevaling the defun makes org-mobile-push complete with no
> errors even when ran from an agenda buffer. Note however:
> 1. There are several more similar lines in org-agenda-redo, which I
> suspect also need to be checked.
> 2. After org-mobile-push, a category filter is applied to the agenda
> buffer ("+Academic"), despite the original agenda buffer having no such
> filter, so it seems that something is broken in
> `org-mobile-create-sumo-agenda' regardless.
>
> I found a (somewhat) relevant post here:
> http://thread.gmane.org/gmane.emacs.orgmode/57481
> If what I wrote makes sense, let me know and I will submit a patch for
> `org-agenda-filter-apply', and if I figure out how to fix
> `org-mobile-create-sumo-agenda', for that as well.
>
> Thanks,
> Kosta
>

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

  reply	other threads:[~2014-05-06 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 11:00 Weird behavior in `org-agenda-redo' and/or `org-mobile-push' Konstantin Kliakhandler
2014-05-06 15:54 ` Konstantin Kliakhandler [this message]
2014-05-06 18:49   ` Konstantin Kliakhandler
2014-05-22 10:59     ` Bastien
2014-05-22 16:08       ` Konstantin Kliakhandler
2014-12-01  6:45         ` Konstantin Kliakhandler

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAH+LVpmAvsbU2UnKe=N+R-OJKnaFSHsRVMtD_Y4+XiJMjGukQQ@mail.gmail.com' \
    --to=kosta@slumpy.org \
    --cc=emacs-orgmode@gnu.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.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).