• Swap the buffers of two windows, which is very useful for side-by-side coding, e.g. the left window for reference and the right window for modification.

    (defun tjh/swap-two-windows ()
      "Swap the current window and the other window."
      (interactive)
      (let* ((current-window (selected-window))
    	 (adjacent-window (next-window)))
        (unless (eq current-window adjacent-window)
          (tjh/swap-window-buffers current-window adjacent-window)
          (select-window adjacent-window))))
    
  • Swap two word using transpose-words, bound to M-t. For example, by placing the cursor between the two words, this converts

    H.prepare_for_vmult_or_tvmult(true, false);
    

    to

    H.prepare_for_vmult_or_tvmult(false, true);
    
  • Customized the colors adopted by the tabbar package to highlight the buffer status.

    • Foreground color: gray75
    • Currently focused buffer (unmodified): dark green
    • Currently focused buffer (modified): chocolate
    • Non-focused buffer (unmodified): gray50
    • Non-focused buffer (modified): saddle brown
    (custom-set-faces
     '(tabbar-default ((t (:inherit variable-pitch :background "gray75" :foreground "gray50" :height 1.3 :family "Noto Sans CJK SC"))))
     '(tabbar-modified ((t (:inherit tabbar-default :foreground "saddle brown" :box (:line-width (1 . 1) :color "white" :style released-button)))))
     '(tabbar-selected ((t (:inherit tabbar-default :foreground "dark green" :box (:line-width (1 . 1) :color "white" :style pressed-button)))))
     '(tabbar-selected-modified ((t (:inherit tabbar-default :foreground "chocolate" :box (:line-width (1 . 1) :color "white" :style released-button))))))