Skip to content

Instantly share code, notes, and snippets.

@steinarb
Created May 19, 2024 11:52
Show Gist options
  • Save steinarb/258106dbce7052ec8cd6c831aedc17a1 to your computer and use it in GitHub Desktop.
Save steinarb/258106dbce7052ec8cd6c831aedc17a1 to your computer and use it in GitHub Desktop.
Changes to .emacs to switch from netrc to auth-source in org2blog wordpress blog credentials setup
diff --git a/.emacs b/.emacs
index d0f7c71..e79c7f5 100644
--- a/.emacs
+++ b/.emacs
@@ -162,16 +162,16 @@ nil if this isn't windows")
(locate-library "org2blog")
(locate-library "metaweblog"))
(require 'org2blog)
- (require 'netrc)
+ (require 'auth-source)
(if (locate-library "ox-wp")
(load-library "ox-wp"))
- (setq blog (netrc-machine (netrc-parse netrc-file) "blog.mydomain.com" t))
+ (setq blog (car (auth-source-search :host "blog.mydomain.com")))
(setq org2blog/wp-blog-alist
(list
(list "my-blog"
:url "http://blog.mydomain.com/xmlrpc.php"
- :username (netrc-get blog "login")
- :password (netrc-get blog "password")))))
+ :username (plist-get blog :user)
+ :password (auth-info-password blog)))))
; Set some default variables
;; Stop making "~" files when saving (making boots 'happy...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment