* Filters not working
@ 2013-08-09 17:37 Thomas S. Dye
2013-08-09 18:29 ` Charles Berry
0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-08-09 17:37 UTC (permalink / raw)
To: Org-mode
Aloha all,
After an upgrade from 8.0.3 this morning I'm unable to export a large
writing project that has kept me from reading the ML regularly for the
last few months. It seems that filters that used to work, no longer do
so. For example,
#+name: tsd-parencites
#+BEGIN_SRC emacs-lisp
(defun tsd-latex-filter-parencites (text backend info)
"Replace parencites placeholders in Beamer/LaTeX export."
(when (memq backend '(beamer latex))
(replace-regexp-in-string "π" "\\parencites" text nil t)))
(add-to-list 'org-export-filter-plain-text-functions
'tsd-latex-filter-parencites)
#+END_SRC
now lets pi slip through into the LaTeX output, giving this error:
ERROR: Package inputenc Error: Unicode char \u8:π not set up for use with LaTeX.
My question, is whether this filter is obviously broken given recent
changes to Org-mode? Any pointers greatly appreciated.
If not, I'll get on with it and try to track down the problem.
All the best,
Tom
--
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 17:37 Filters not working Thomas S. Dye
@ 2013-08-09 18:29 ` Charles Berry
2013-08-09 19:39 ` Thomas S. Dye
0 siblings, 1 reply; 9+ messages in thread
From: Charles Berry @ 2013-08-09 18:29 UTC (permalink / raw)
To: emacs-orgmode
Thomas S. Dye <tsd <at> tsdye.com> writes:
>
> Aloha all,
>
> After an upgrade from 8.0.3 this morning I'm unable to export a large
> writing project that has kept me from reading the ML regularly for the
> last few months. It seems that filters that used to work, no longer do
> so. For example,
>
> #+name: tsd-parencites
> #+BEGIN_SRC emacs-lisp
> (defun tsd-latex-filter-parencites (text backend info)
> "Replace parencites placeholders in Beamer/LaTeX export."
> (when (memq backend '(beamer latex))
> (replace-regexp-in-string "π" "\\parencites" text nil t)))
> (add-to-list 'org-export-filter-plain-text-functions
> 'tsd-latex-filter-parencites)
> #+END_SRC
>
> now lets pi slip through into the LaTeX output, giving this error:
>
> ERROR: Package inputenc Error: Unicode char \u8:π not set up for use with
LaTeX.
>
> My question, is whether this filter is obviously broken given recent
> changes to Org-mode? Any pointers greatly appreciated.
>
Did you upgrade as in 'git pull'? If not, I cannot help.
If so,
This bit of org-mode:
,----
| * headline
|
|
| #+BEGIN_SRC emacs-lisp :eval yes :exports both
| (defun test-filter-final (text back-end info)
| "What is back-end?"
| (concat "type-of back-end: "
| (format "%S" (type-of back-end))
| "\nname of back-end: "
| (symbol-name (org-export-backend-name back-end))))
|
| (add-to-list 'org-export-filter-final-output-functions 'test-filter-final)
| #+END_SRC
`----
will export via
C-c C-e l L y
as
,----
| type-of back-end: vector
| name of back-end: latex
`----
Take a look at "(defstruct (org-export-backend..." in ox.el
HTH,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 18:29 ` Charles Berry
@ 2013-08-09 19:39 ` Thomas S. Dye
2013-08-09 20:30 ` Aaron Ecay
2013-08-09 20:52 ` Charles Berry
0 siblings, 2 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-08-09 19:39 UTC (permalink / raw)
To: Charles Berry; +Cc: emacs-orgmode
Charles Berry <ccberry@ucsd.edu> writes:
> Did you upgrade as in 'git pull'? If not, I cannot help.
Yes, Org-mode version 8.0.7 (release_8.0.7-377-gef2d47 @
/Users/dk/.emacs.d/src/org-mode/lisp/)
>
> If so,
>
> This bit of org-mode:
>
> ,----
> | * headline
> |
> |
> | #+BEGIN_SRC emacs-lisp :eval yes :exports both
> | (defun test-filter-final (text back-end info)
> | "What is back-end?"
> | (concat "type-of back-end: "
> | (format "%S" (type-of back-end))
> | "\nname of back-end: "
> | (symbol-name (org-export-backend-name back-end))))
> |
> | (add-to-list 'org-export-filter-final-output-functions 'test-filter-final)
> | #+END_SRC
> `----
>
> will export via
>
> C-c C-e l L y
>
> as
>
> ,----
> | type-of back-end: vector
> | name of back-end: latex
> `----
Yes, it does.
>
> Take a look at "(defstruct (org-export-backend..." in ox.el
OK, I had a look at org-export-backend, but not sure what I'm looking
for in particular.
I did note that you don't test back-end directly, but instead look at
org-export-backend-name. Perhaps this is what Nicolas means by "Filters
defined here shouldn't make a back-end test, as it may prevent back-ends
derived from this one to behave properly"?
However, changing my filter so it uses org-export-backend-name doesn't
seem to change anything.
Or, was I supposed to learn something else from ox.el?
Thanks for your help.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 19:39 ` Thomas S. Dye
@ 2013-08-09 20:30 ` Aaron Ecay
2013-08-09 21:16 ` Thomas S. Dye
2013-08-09 20:52 ` Charles Berry
1 sibling, 1 reply; 9+ messages in thread
From: Aaron Ecay @ 2013-08-09 20:30 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode@gnu.org, Charles Berry
Thomas,
Since backends are no longer passed as symbols, but as structs, I
think you should use the `org-export-derived-backend-p' function.
Does your code work if you replace `(memq backend ...)' with
`(org-export-derived-backend-p backend 'latex)'? (beamer is derived
from latex, so you don't need a separate test for it.)
Aaron
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 20:30 ` Aaron Ecay
@ 2013-08-09 21:16 ` Thomas S. Dye
0 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-08-09 21:16 UTC (permalink / raw)
To: Aaron Ecay; +Cc: emacs-orgmode@gnu.org, Charles Berry
Aaron Ecay <aaronecay@gmail.com> writes:
> Thomas,
>
> Since backends are no longer passed as symbols, but as structs, I
> think you should use the `org-export-derived-backend-p' function.
> Does your code work if you replace `(memq backend ...)' with
> `(org-export-derived-backend-p backend 'latex)'? (beamer is derived
> from latex, so you don't need a separate test for it.)
Thanks Aaron, that works.
Now, to finish off that writing project ...
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 19:39 ` Thomas S. Dye
2013-08-09 20:30 ` Aaron Ecay
@ 2013-08-09 20:52 ` Charles Berry
2013-08-09 21:18 ` Thomas S. Dye
1 sibling, 1 reply; 9+ messages in thread
From: Charles Berry @ 2013-08-09 20:52 UTC (permalink / raw)
To: emacs-orgmode
Thomas S. Dye <tsd <at> tsdye.com> writes:
>
> Charles Berry <ccberry <at> ucsd.edu> writes:
>
[filter to demo extracting back-end name deleted]
> >
> > ,----
> > | type-of back-end: vector
> > | name of back-end: latex
> > `----
>
> Yes, it does.
>
> >
> > Take a look at "(defstruct (org-export-backend..." in ox.el
>
> OK, I had a look at org-export-backend, but not sure what I'm looking
> for in particular.
>
> I did note that you don't test back-end directly, but instead look at
> org-export-backend-name. Perhaps this is what Nicolas means by "Filters
> defined here shouldn't make a back-end test, as it may prevent back-ends
> derived from this one to behave properly"?
That comment was in the context of back-end specific filters and aimed at
back-end developers. You are adding to
org-export-filter-plain-text-functions, which is for users. So, go ahead
and test.
>
> However, changing my filter so it uses org-export-backend-name doesn't
> seem to change anything.
>
> Or, was I supposed to learn something else from ox.el?
>
The changes introduced in commit
cea0434c4f7f7f1fc1547e6790b96a76bc217e15
ox: Change back-ends internal representation to structures
necessitate extracting the name of the back-end from a vector.
So, this bit of code
(memq backend '(beamer latex))
will never return t, because backend is a vector.
Probably what you want is
(memq (org-export-backend-name backend) '(latex beamer))
HTH,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 20:52 ` Charles Berry
@ 2013-08-09 21:18 ` Thomas S. Dye
2013-08-10 7:46 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-08-09 21:18 UTC (permalink / raw)
To: Charles Berry; +Cc: emacs-orgmode
Charles Berry <ccberry@ucsd.edu> writes:
> The changes introduced in commit
>
> cea0434c4f7f7f1fc1547e6790b96a76bc217e15
> ox: Change back-ends internal representation to structures
>
> necessitate extracting the name of the back-end from a vector.
>
> So, this bit of code
>
> (memq backend '(beamer latex))
>
> will never return t, because backend is a vector.
>
> Probably what you want is
>
> (memq (org-export-backend-name backend) '(latex beamer))
Yes, got it now.
Thanks for your help.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-09 21:18 ` Thomas S. Dye
@ 2013-08-10 7:46 ` Nicolas Goaziou
2013-08-10 16:34 ` Thomas S. Dye
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2013-08-10 7:46 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode, Charles Berry
Hello,
tsd@tsdye.com (Thomas S. Dye) writes:
> Charles Berry <ccberry@ucsd.edu> writes:
>
>> The changes introduced in commit
>>
>> cea0434c4f7f7f1fc1547e6790b96a76bc217e15
>> ox: Change back-ends internal representation to structures
>>
>> necessitate extracting the name of the back-end from a vector.
>>
>> So, this bit of code
>>
>> (memq backend '(beamer latex))
>>
>> will never return t, because backend is a vector.
>>
>> Probably what you want is
>>
>> (memq (org-export-backend-name backend) '(latex beamer))
>
> Yes, got it now.
Actually, I didn't mean to introduce a type change in filter arguments.
I fixed it: BACKEND is again a symbol. `org-export-derived-backend-p'
still works, and so does `memq'.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Filters not working
2013-08-10 7:46 ` Nicolas Goaziou
@ 2013-08-10 16:34 ` Thomas S. Dye
0 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-08-10 16:34 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode, Charles Berry
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Actually, I didn't mean to introduce a type change in filter arguments.
>
> I fixed it: BACKEND is again a symbol. `org-export-derived-backend-p'
> still works, and so does `memq'.
Thanks Nicolas. I can confirm that my old filters with memq work again
and that the new ones with org-export-derived-backend-p work for me,
too.
All the best,
Tom
--
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-08-10 16:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-09 17:37 Filters not working Thomas S. Dye
2013-08-09 18:29 ` Charles Berry
2013-08-09 19:39 ` Thomas S. Dye
2013-08-09 20:30 ` Aaron Ecay
2013-08-09 21:16 ` Thomas S. Dye
2013-08-09 20:52 ` Charles Berry
2013-08-09 21:18 ` Thomas S. Dye
2013-08-10 7:46 ` Nicolas Goaziou
2013-08-10 16:34 ` Thomas S. Dye
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.