org2blog / org2blog

Blog from Org mode to WordPress.

Home Page:https://github.com/org2blog/org2blog/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"byte-code: Symbol’s value as variable is void: metaweblog-version" Error When Starting org2blog UI

bradfonseca opened this issue · comments

Thank you for filing this bug report. To make it easier for you and easier for
us please answer these five short questions:

  • What did you do?
    Ran the command: org2blog-user-interface
  • What did you expect to happen?
    I expect to see the main menu.
  • What happened instead?
    I got the error: byte-code: Symbol’s value as variable is void: metaweblog-version
  • Did you review issue tracker to see if this bug is already
    reported or resolved?
    I reviewed available issues and did not find this specific issue. Sorry. :(
  • Did you review the README about how this feature works?
    I attempted to search the README for metaweblog and found a section discussing it but not my issue.

I am using emacs 26.3 and Org mode 9.3.2

@bradfonseca Oh no! Sorry about that. I think we'll get it resolved pretty quickly.

Thank you for the thoughtful report: much appreciated.

My gut feeling is that when Org2Blog got installed by your package manager there was a "hiccup". No really. Here is why:

There was a techie change behind the scenes in version 1.1.1 and it seems like for maybe one in a few hundred installations this happens: the package manager thinks that metaweblog is installed when it really isn't. Here is how to resolve it by reinstalling Org2Blog to get MetaWeblog installed correctly:

Either go into your package manager and delete org2blog (and metaweblog if it /is/ listed in there) or simply go to your Elpa directory (probably ~/.emacs.d/elpa) and rename org2blog-nnn and metaweblog-nnn to use the suffix "-old" instead. Then restart Emacs and install org2blog again.

After loading Org2Blog you should be able to test the value of metaweblog like this (metaweblog should get installed automatically):

  • In Emacs, type
  • C-h v /strike enter/
  • metaweblog-version /strike enter/
  • Now a window should successfully display the version number like this

Screenshot 2020-01-30 18 42 35

Thanks for your patience on this.

Let me know how that goes.

Thank you! Your instructions [mostly] worked and I was able to successfully start org2blog and log into my WordPress blog. I did have to install MetaWeblog manually from the package manager. After I did this, everything worked and I got to the UI as it appears in your README file.

However, when I create a new buffer, I get a blank page. Is this correct behaviour? When I check the Messages in emacs I see:

org2blog-entry-buffer-make: Symbol’s function definition is void: string-join

I have set up my profile using your template:

(setq org2blog/wp-blog-alist '(("myblog" :url "https://myblog.com/xmlrpc.php" :username "username")))

Is there something else wrong? In the old version of org2blog, I used the following:

(setq org2blog/wp-blog-alist '(("myblog" :url "https://myblog.com/xmlrpc.php" :username "username" :default-title "Insert Title Here!" :default-categories ("org2blog" "emacs") :default-tags ("org2blog" "emacs") :tags-as-categories nil)))

I've tried both and get the same error message and a blank buffer. Previously, I would get a pre-populated buffer with something like the following:

#+BLOG: wordpress

#+POSTID:

#+ORG2BLOG:

#+DATE:

#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil

#+CATEGORY: org2blog" "emacs"

#+TAGS: org2blog" "emacs"

#+DESCRIPTION:

#+TITLE: Insert Title Here!

Is there something else wrong with my configuration?

Thanks,

Brad

Excellent! Definitely closer. With that in mind I have some questions for you that should help us start narrowing things down.

Your configuration looks great. The configuration options remain the same, unchanged, since the last release of Org2Blog. Your settings should work fine right now. You should definitely see a new buffer populated by a fresh post, too. There is definitely a problem if Org2Blog can't find string-join so I want to check those version numbers.

After starting Emacs and Org2Blog loads a debug message should show up in the *Messages* buffer that looks something like this

Screenshot 2020-02-02 16 31 52

What does it say in your buffer?

Wonder where string-join is so please type C-h f string-join /strike-enter/. A buffer should appear like this

Screenshot 2020-02-02 16 31 57

What shows up for you?

string-join lives in the subr-x package and I want to know if Org2Blog can see it so please type M-x apropos-library /strike enter/ subr-x /strike enter/ and you should see something like this

Screenshot 2020-02-02 16 37 54

What shows up for you?

What does it say in your buffer?

I get the following:
Org2Blog Runtime: Org2Blog 1.1.1, Emacs 26.3, Org Mode 9.3.2, MetaWeblog 1.1.1, XML-RPC 1.6.12

Wonder where string-join is so please type C-h f string-join /strike-enter/.

I get the following:
string-join is a compiled Lisp function in ‘subr-x.el’.
(string-join STRINGS &optional SEPARATOR)
Join all STRINGS using SEPARATOR.
string-join lives in the subr-x package and I want to know if Org2Blog can see it so please type M-x apropos-library /strike enter/ subr-x /strike enter/ and you should see something like this

What shows up for you?

I get the following (similar to what you have...):
emacs_apropos_subr-x

Looks like everything is working the way your system works? Anything else you want me to check?

Brad

Hmm, this is weird! It now works!:
org2blog_new_buffer

If I re-enable my old profile set-up command in my init.el file:

org2blog_setup_profile_init_file

I get the same string-join error from before:
org2blog-entry-buffer-make: Symbol’s function definition is void: string-join

Is there something wrong with my profile set-up command?

Further weirdness....I went back to your simpler profile set-up command and got the string-join error. But after I went through your troubleshooting steps (e.g. C-h f string-join /strike-enter/ and M-x apropos-library /strike enter/ subr-x /strike enter/) it works!

Why do you suppose that is?

Additional information. I went back to my old set-up command:
org2blog_setup_profile_init_file

Then, I tried to start a new buffer and got the string-join error. Then, I ran your troubleshooting commands: C-h f string-join /strike-enter/ and M-x apropos-library /strike enter/ subr-x /strike enter/ and I got my buffer to load (mostly) correctly:

org2blog_new_buffer_original_set-up

It's not loading my default tags but appears to work okay. I was able to post a test draft to my blog and trash it.

What do you supposed is happening?

More clarification (I apologize profusely for all the posts....): If I run C-h f string-join /strike-enter/ ONLY, it still resolves the issue. It's as though it needs help finding the function. Does that make any sense to you?

Thanks for digging into this!

I think that there is a bug in Org2Blog's code: in some cases it is using string-join before the subr-x package is loaded.

I'm going to make a change in a branch for you to try out after I test some things out first.

@bradfonseca Just created a patch here

If you are willing then please test it out by either

  • Going to your ~/.emacs.d/elpa
  • Making a backup of the org2blog directory to "-pre-fix" for example
  • Download the new org2blog.el into the org2blog directory
  • Restart Emacs

or the other option is to just copy and paste one line of code into org2blog.el so it looks like this:

(require 'org)
(require 'ox-wp)
(eval-when-compile (require 'subr-x)) ; Paste this new line in

and then restart Emacs.

Now subr-x and the string-join function should be loaded before Org2Blog creates the new post buffer. I believe that your configuration is fine.

If you test it out then please let me know the results.

@grettke I tried your updated file but the issue remains. If I run C-h f string-join /strike-enter/ ONLY, it still resolves the issue. I verified the correct file is in the correct folder. I restarted Emacs. I still get the same error (until I invoke C-h f string-join /strike-enter/ which fixes the issue, except for not loading my default tags...which I mentioned before). Could it be another issue?

Definitely could be another issue I'm just not seeing it quite yet.

What is the Org2Blog debug message in the *Messages* buffer? It should be Org2Blog 1.1.2.

Interesting, I see Org2Blog Runtime: Org2Blog 1.1.1, Emacs 26.3, Org Mode 9.3.2, MetaWeblog 1.1.1, XML-RPC 1.6.12

I assure you that I followed your instructions as stated.

Perhaps I have poor directions 😧!

Please blow away the Org2Blog directory, reinstall, and finally drop in the new file.

The new version should get loaded.

See how that goes.

@grettke I'm so sorry but it still has the same issue. I deleted the org2blog 1.1.1 folder, started Emacs, reinstalled the package, downloaded and replaced org2blog.el. What now? Somehow.either it's using the old file even though I deleted it or the fix isn't working as expected.

Would including (require 'subr-x) somewhere in my init.el file help?

@bradfonseca Thank you for your patience!

Definitely insert this before you load Org2Blog

(eval-when-compile (require 'subr-x))

I inserted (require 'subr-x) into my init.el file and commented out (require 'org2blog-autoloads) since it doesn't appear to be needed any more. I was able to start Org2Blog and I was able to create a buffer with only minor issues:

org2blog_new_buffer_original_set-up

The only remaining issue is that my default tags don't load. My Org2Blog profile is as follows in my init.el:

org2blog_setup_profile_init_file

It's a pretty minor issue so I'm more curious than anything why it doesn't work.

A big "Thank You!" to you for all your help troubleshooting the issue so far. :)

Glad to hear it!

I still have some testing to do on that change. When I'm done testing shall I close the issue?

I'm thinking that we move the default tags topic into a new issue because it is a separate issue from that which resolved this one.

What do you think?

Agreed. I'll open a new ticket for the default tags issue.

Thanks for all the work done so far.

@bradfonseca Just pushed the change. It will propagate to MELPA within the next day or two (if not sooner). After that you can remove the require of subr-x in your init file.

Let me know if you run into any problems.

Resolved in v1.1.3.