Blogging with Emacs Org-Mode

29/12/2020
Chưa phân loại
Thanks to the many plug-ins for Emacs, you can write to your blog from inside your favourite editor. This is useful for people that use their favourite editor most of the day. To post to your WordPress blog, you can use Org2blog. It is easy to setup and has a nice user-interface to boot.

For other platforms you have other packages, the standard term for plug-ins, in Emacs. If you use Googles Blogger, you need to install bpe. There are several other packages that support Jekyll and other parsing systems.

There is also a package for those of you who uses the Tinkerer blogging engine. More on that in another post.

The Org2blog package

The org2blog package calls the WordPress site and sends your blogs there. This works on both self-hosted and the free WordPress.com website. The package is available from MELPA or Github. If you take it from GitHub, you need to add it to your path, on your own. This is useful if you want to follow updates or even contribute. You will have to make sure the dependencies are installed though. The package depends on:

xml-rpc metaweblog.el htmlize

You can add these from MELPA, using ‘package’.

$ ‘M-x install-package xml-rpc metaweblog htmlize

The code to include the package if you have copied it in, add the following code to your .emacs file or directory.

(setq load-path (cons "~/.emacs.d/org2blog/" load-path))
(require ‘org2blog-autoloads)

Defining your credentials and platforms.

Before you can do anything, you need to define what and where you are about to publish to. This requires more code in your .emacs file or directory. To define your credentials add this to your .emacs file.

(setq org2blog/wp-blog-alist
‘(("my-blog"
:url "https://example.com/xmlrpc.php"
:default-title "How To "
:username "admin")
("My-other-blog"
:url "https://other.example.com/xmlrpc.php"
:default-title "My new recipe "
:username "Johnny")
))

Note that this is a list, if you have many blogs, add them to the list. Be careful with the parenthesis, they are key to LISP. You set the username to your own, of course. The password comes later, just below here. You also have more settings than this, default-categories is one option. When you want to send a post, first, you have to be logged in. Logging in is done with:

‘M-x org2blog/wp-login’

The minibuffer will ask you which blog you want to post to. If you have put the same code as above you can only choose ‘my-blog’. What you call it, is up to you. You can also create one entry for each blog you have, if you have many. A warning, as of this writing, the setting below while needed, is not set by default. You may need to set this in your .emacs.d files(s).

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

Now, you have logged in, you can start creating.

Drafting, previewing and publishing.

To create a new post, you have the option to call ‘M-x org2blog/wp-new-entry’ or use the Hydra page. On the Hydra page, you have a list of options including to add a new entry. You will have a new buffer with default values set. You can set those default values your self. Those settings are set the same way any Org-mode documents have their settings. In general, the values control how an export works. They also contain the tags, category and other values. While you are writing a post you can set these in the top of the document. It is not strictly necessary to have it in the top but it makes it easy to find for long posts. The format has a ‘#+’ and then the value you want to set.

#+TITLE How to blog on the command line
#+OPTIONS toc:nil num:nil todo:nil pri:nil tags:nil ^:nil
#+TAGS Geeks, bash, emacs
#+CATEGORY Linux, MacOS
#+DESCRIPTION This post covers all manners of blogging to command line
#+DATE <2019-07-28 Sun>

The values are all optional but it is great to have it set for your post. The tags are the tags on the blogs, categories are the ones you already have or you can put a new one. Org2blog will ask you if it should create the new category later when you post. Once you have written your post, you can create a draft and view it with the below command.

‘M-x org2blog/wp-post-buffer’ or ‘M-x org2blog/wp-post-buffer-and-publish’

The first will create a draft for you to check over and the second will publish it to your blog. You can also change an existing post, all you need is the post-id which is created when you post your post. The value is at the top of your local copy of your post.

Conclusion

Using Emacs to blog is an excellent way to get your message out. You will need to get used to a new way of creating your post if you are using the web based editor until now. However, if you are considering to do this, you are probably in your editor most of the time which makes the transition simpler.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh

ProxyDroid là một ứng dụng hữu ích được sử dụng để giúp người dùng duyệt web ẩn danh và truy...
03/06/2024

Find UUID of Storage Devices in Linux

UUID is a unique identifier used in partitions to uniquely identify partitions in Linux operating systems. UUID is a property...
29/12/2020

Linux Distribution Comparison

There are currently nearly 300 active Linux distributions, which makes choosing just one somewhat difficult, especially...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1
28/05/2024