Remove Every Source Block Results

Sometimes you accidentally evaluate your entire Org-Mode document resulting in result blocks everywhere. Maybe you can’t easily revert the change so you are stuck with a ton of code you don’t need. Here is a function to remove all of your result blocks. It is pretty good for documents that you probably never wanted to evaluate in the first place:

(defconst help/org-special-pre "^\s*#[+]")
(defun help/org-2every-src-block (fn)
  "Visit every Source-Block and evaluate `FN'."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (let ((case-fold-search t))
      (while (re-search-forward (concat help/org-special-pre "BEGIN_SRC") nil t)
        (let ((element (org-element-at-point)))
          (when (eq (org-element-type element) 'src-block)
            (funcall fn element)))))
    (save-buffer)))
(define-key org-mode-map (kbd "s-]") (lambda () (interactive)
                                       (help/org-2every-src-block
                                        'org-babel-remove-result)))

(Screencast) Building A Little UI To Manage Buffers

(use-package eyebrowse
  :ensure t
  :config
  (setq eyebrowse-wrap-around t)
  (eyebrowse-mode t)
  (defhydra help/hydra-left-side/eyebrowse (:color blue :hint nil)
    "
current eyebrowse slot: %(eyebrowse--get 'current-slot)
 _j_ previous _k_ last _l_ next _u_ close _i_ choose _o_ rename _q_ quit
   _a_ 00 _s_ 01 _d_ 02 _f_ 03 _g_ 04 _z_ 05 _x_ 06 _c_ 07 _v_ 08 _b_ 09"
    ("j" #'eyebrowse-prev-window-config :exit nil)
    ("k" #'eyebrowse-last-window-config)
    ("l" #'eyebrowse-next-window-config :exit nil)
    ("u" #'eyebrowse-close-window-config :exit nil)
    ("i" #'eyebrowse-switch-to-window-config)
    ("o" #'eyebrowse-rename-window-config :exit nil)
    ("q" nil)
    ("a" #'eyebrowse-switch-to-window-config-0)
    ("s" #'eyebrowse-switch-to-window-config-1)
    ("d" #'eyebrowse-switch-to-window-config-2)
    ("f" #'eyebrowse-switch-to-window-config-3)
    ("g" #'eyebrowse-switch-to-window-config-4)
    ("z" #'eyebrowse-switch-to-window-config-5)
    ("x" #'eyebrowse-switch-to-window-config-6)
    ("c" #'eyebrowse-switch-to-window-config-7)
    ("v" #'eyebrowse-switch-to-window-config-8)
    ("b" #'eyebrowse-switch-to-window-config-9))
  (global-set-key (kbd "C-M-e") #'help/hydra-left-side/eyebrowse/body))

Looking For Tips On Making Emacs Screencasts

When I produce an Emacs screencast it takes four or five hours. That is after producing a handful that I’ve published and a few that I threw away. Over time I expect the process to get shorter but it is still pretty long.

There are a lot of Emacs screencasters out there. In addition to the tips there:

How long do you spend producing your screencasts and what are you tips and tricks to get the most production value in the least time?

Easily Avoid Using The Word Easily In Your Emacs Configuration

My Emacs configuration contains over one hundred uses of the “easy” word form. Lines and lines of code explain how to easily do something. I even put together a package to easily do something. Each begging a question or two.

Why would I ever put something in my configuration to make a task strenuous? Would would I ever write code to make doing things difficult? But it is revealing.

Continue reading “Easily Avoid Using The Word Easily In Your Emacs Configuration”

Org2Blog v1.0.0 Released!

Seven years ago today @punchagan made the first commit 4f41f5c on Org2Blog. He started what has grown to be a loved and adored Emacs package. Combining the power of Org-Mode with the gargantuan wealth of WordPress, Org2Blog unites the two creating one of the worlds most elegant blogging systems ever. Thousands of users around the world use it daily with big smiles on their faces.

Thank you @punchagan, contributors, issue and feature reporters, Org-Mode team, Emacs team and the Philosophy of the GNU Project for sharing this gift with the world.

After seven years of development, maintenance, support and new features along with years of stable use, Org2Blog is ready for a major release at v1.0.0.

By the way, it is exactly seven years today and I absolutely did not plan this timing at all!

Maybe The Four Most Important Key-Bindings For High-Speed Org-Mode Literate Programming

Ever watched an Org-Mode Literate Programming program at all? How about progam quickly? I have. I mean I have done both, myself. Can you believe that you can navigate the document, all of its source blocks and fly between editing the source buffer and returning to the host buffer just as fast as a working within a normal code file? You should. Some day I’ll make a screencast proving it. Until then try out these bindings and you will see how quickly you can do Literate Programming fast while having fun:

(define-key org-mode-map (kbd "s-j") #'org-babel-next-src-block)
(define-key org-mode-map (kbd "s-k") #'org-babel-previous-src-block)
(define-key org-mode-map (kbd "s-l") #'org-edit-src-code)
(define-key org-src-mode-map (kbd "s-l") #'org-edit-src-exit)

Auto-Loading Org2Blog Mode

Org2Blog enables you to blog from an Org-Mode document straight into a WordPress post or page. My blog has an individual file for every post or page for example. You can also keep them all in a single file if you like. Everybody uses Org2Blog differently.

Some people like to use org2blog/wp-mode when they are working on their posts. The trouble is that they have got to start the mode manually every time. That is because Org2Blog files are plain old Org-Mode files. So there is no obvious way to automatically enable org2blog/wp-mode. There are a lot of ideas on how to automatically enable it and this is the one that got implemented. Here is how it works:

  • Add org2blog/wp-org-mode-hook-fn to org-mode-hook
  • So that org2blog/wp-mode is automatically enabled when #+ORG2BLOG: is present
  • Add code like this somewhere after you load Org-Mode and org2blog

    (add-hook 'org-mode-hook #'org2blog/wp-org-mode-hook-fn)
    
  • Add #+ORG2BLOG: to your file
    • When you create a new entry it is automatically created

Emacs' Buffer: The Ultimate Idea

Do you ever struggle to explain Emacs’ astounding power to other non-Emacsers?

Usually I do, but in this post is the first time that I ever felt that I did it some justice. But that is just a feeling and I want to know your take on it.

It is raw and unrefined, but, if you can read it just from one Emacser to another Emacser then want to hear your take on it, too. Your time is precious and this is something near and dear to my heart so I appreciate you spending your time to share your feedback and ideas.

Here is my response to the question What are the pros and cons of Emacs’ everything is a buffer approach and how does Atom compare in this regard?

Continue reading “Emacs' Buffer: The Ultimate Idea”