alphapapa/org-protocol-capture-html

Symbol's function definition is void: string-trim

Closed this issue ยท 8 comments

I'm getting the following error when org-protocol-capture-html-with-pandoc gets called:

*ERROR*: Symbol's function definition is void: string-trim

Here's my Emacs version:

GNU Emacs 24.5.1 (x86_64-apple-darwin15.3.0, NS apple-appkit-1404.34) of 2016-03-15

I tested with Emacs 25 and I see that string-trim does exist there, so it looks like this package currently has an Emacs 25+ requirement that isn't mentioned in the README.

Hi, thanks for reporting this. I'm not sure what the problem is though, because I'm using Emacs 24.4 myself, and other people are using it on Emacs 24, so it definitely doesn't depend on Emacs 25 (which isn't even released yet). The only thing I can think of is that something in your Emacs installation wasn't built properly and left that function out, but that would seem pretty strange. Where did you download or install Emacs from? I use Linux, so I don't know much about installing Emacs on OS X.

I'm going to go ahead and mark this as invalid since I don't think it's a bug here, but I'll try to help you get it working if I can.

Hmm, odd. I installed Emacs via Homebrew (see emacs.rb formula), which built Emacs 24.5 from source using --with-cocoa --with-gnutls. It's the same Emacs from https://www.gnu.org/software/emacs/. The only thing I can think of is that string-trim got removed in 24.5? That seems odd...

I just deleted and recompiled Emacs 24.5. Still no string-trim available. The subr-x.el file that defines string-trim is present in the Emacs 24.5 distribution that I compiled (http://ftpmirror.gnu.org/emacs/emacs-24.5.tar.xz), but when I start up Emacs and try running C-h f string-trim I get "No match". If I switch to Emacs 25, C-h f string-trim gives me the definition.

Ok, I think I see the problem, which is that subr-x isn't being required. I ran emacs -q and the function is not defined. Apparently it is loaded in some other packages I have installed, and I didn't realize that it wasn't loaded by default, so I didn't require it here.

What's really surprising is that you're the first to report this problem. I guess everyone else who's using this happens to have other packages loaded that load subr-x, so they didn't encounter the error. And I guess anyone who did encounter it didn't bother to report it--until you! :)

...and maybe Emacs 25 does load it by default? Hmm...

I'll fix this right away. Thank you for taking the time to report it! I would have eventually caught it when I prepared it for MELPA, but better to fix it sooner. Sorry for putting you through the trouble of rebuilding Emacs and all that.

@alphapapa Yes! (require 'subr-x) fixed it for me! ๐Ÿ˜€ Thanks for sorting that out and for the great package!

:) If you have any other feedback, just let me know!

I meet this issue too, and (require 'subr-x) helps me. My Emacs Version is 24.5 (9.0).

@yuanbohan Thanks, but I'm a bit confused: I fixed this bug over a year ago, so it shouldn't be happening anymore. Are you using an old version of this package?