emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Custom agenda - wrong type argument
@ 2010-04-14 15:54 Nathan Neff
  2010-04-16 21:07 ` Nathan Neff
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Neff @ 2010-04-14 15:54 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2666 bytes --]

I'm trying to build a custom agenda that works with the current buffer.

I've succeeded in getting the agenda to display with the
current buffer like this:

(setq org-agenda-custom-commands
      (quote (
         ("c" "Current Buffer" agenda "" ((org-agenda-files (list
(buffer-file-name)))))
         ("f" "Home Buffer" agenda "" ((org-agenda-files
'("~/Documents/personal/nate.org"))))
         )
      )
)

However, when I view the agenda for the current buffer (by pressing "c",
every key I press gives me "Wrong type argument: stringp, nil".

The "Home Buffer" custom command above works fine.

I know that you can easily restrict the agenda to the current file by
pressing "<" in the
dispatcher, but I'm just hacking around and seeing how org-mode and lisp
works.

I'm using a bare-bones org-configuration:

Emacs  : GNU Emacs 23.1.93.1 (i386-apple-darwin9.8.0, NS
apple-appkit-949.54)
 of 2010-03-09 on braeburn.aquamacs.org - Aquamacs Distribution 2.0preview5
Package: Org-mode version 6.35 (release_6.35g.25.g609e.dirty)

current state:
==============
(setq
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-agenda-custom-commands '(("c" "Current Buffer" agenda ""
((org-agenda-files (list (buffer-file-name)))))
                  ("f" "Home Buffer" agenda ""
                   ((org-agenda-files (quote ("~/Documents/personal/nate.org
")))))
                  )

 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-support-shift-select t
 org-export-preprocess-hook '(org-export-blocks-preprocess)
 org-tab-first-hook '(org-hide-block-toggle-maybe)
 org-src-mode-hook '(org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
          org-optimize-window-after-visibility-change)
 org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
           [org-add-hook change-major-mode-hook org-show-block-all append
local] 5]
         )
 org-confirm-elisp-link-function 'yes-or-no-p
 org-occur-hook '(org-first-headline-recenter)
 org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
org-beamer-auto-fragile-frames
                   org-beamer-place-default-actions-for-lists)
 )


Thanks,
--Nate

[-- Attachment #1.2: Type: text/html, Size: 3268 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Custom agenda - wrong type argument
  2010-04-14 15:54 Custom agenda - wrong type argument Nathan Neff
@ 2010-04-16 21:07 ` Nathan Neff
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Neff @ 2010-04-16 21:07 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1534 bytes --]

On Wed, Apr 14, 2010 at 10:54 AM, Nathan Neff <nathan.neff@gmail.com> wrote:

> I'm trying to build a custom agenda that works with the current buffer.
>
> I've succeeded in getting the agenda to display with the
> current buffer like this:
>
> (setq org-agenda-custom-commands
>       (quote (
>          ("c" "Current Buffer" agenda "" ((org-agenda-files (list
> (buffer-file-name)))))
>          ("f" "Home Buffer" agenda "" ((org-agenda-files
> '("~/Documents/personal/nate.org"))))
>          )
>       )
> )
>
> However, when I view the agenda for the current buffer (by pressing "c",
> every key I press gives me "Wrong type argument: stringp, nil".
>
>
I fixed it!  I found a fairly slick workaround for the problem.
Before calling (org-agenda), I set a variable called
njn/current-buffer-file-name, and refer to that variable in my custom agenda
view.

(defun njn/org-agenda ()
  (interactive)
  (setq njn/current-buffer-name (buffer-file-name))
  (org-agenda)
)

I have an example of the fixed and broken custom agenda commands below:

(setq org-agenda-custom-commands
      '(
         ("c" "Current Buffer" agenda ""
           ((org-agenda-files (list njn/current-buffer-name)))
         )
         ("x" "This doesn't Work.  It gets the right data, but wont
      let you issue any other agenda commands" agenda ""
           ((org-agenda-files (list (buffer-file-name))))
         )
       )
)

Instead of calling (org-agenda), I just call (njn/org-agenda)

(global-set-key (kbd "<f5>") 'njn/org-agenda)

Thanks,
--Nate

[-- Attachment #1.2: Type: text/html, Size: 2164 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-04-16 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-14 15:54 Custom agenda - wrong type argument Nathan Neff
2010-04-16 21:07 ` Nathan Neff

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).