Posted: 13 May 2024. At: 8:55 AM. This was 2 months ago. Post ID: 19597
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Interesting Emacs trick, insert spook words into a document.

The famous Emacs editor has an interesting feature, which can insert spook words into a document.

;; To use this:
;;  Just before sending mail, do M-x spook.
;;  A number of phrases will be inserted into your buffer, to help
;;  give your message that extra bit of attractiveness for automated
;;  keyword scanners.  Help defeat the NSA trunk trawler!

The meta key should be Alt by default, press the Meta-x shortcut; and at the bottom of the editor, you should see an M-x prompt. Type ‘spook’ and press RETURN and the words will be inserted in the cursor position.

Here is a sample of spook words.

Federal Aviation Administration MSNBC Flu UKUSA Electric Egret NTIS RL
FKS La Familia Suspicious package penrep NWO Air Marshal IRIDF

When text is highlighted, press Meta-w to copy the text to the clipboard. Control-y will paste it.

To open the Emacs psychotherapist, type Meta-x and type ‘doctor’.

I am the psychotherapist.  Please, describe your problems.  Each time
you are finished talking, type RET twice.

Here is an elisp function that allows splitting the Emacs window horizontally.

(defun hsplit-parent ()
  "horizontal split of parent window, or curr if no parent."
  (let ((p (window-parent)))
    (if p
        (split-window p nil t)
      (split-window-horizontally))))

This Emacs config will also allow horizontal splitting of the Emacs window.

(defun baal-split-window-sensibly (&optional window)
  "Split WINDOW in a way suitable for `display-buffer'.
WINDOW defaults to the currently selected window.
If `split-width-threshold' specifies an integer, WINDOW is at
least `split-width-threshold' lines wide and can be split
horizontally, split WINDOW into two windows side by side and
return the right window.  Otherwise, if `split-height-threshold'
specifies an integer, WINDOW is at least `split-height-threshold'
columns tall and can be split vertically, split WINDOW into two
windows one above the other and return the lower window.  If this
can't be done either and WINDOW is the only window on its frame,
try to split WINDOW horizondally disregarding any value specified
by `split-width-threshold'.  If that succeeds, return the right
window.  Return nil otherwise.
 
By default `display-buffer' routines call this function to split
the largest or least recently used window.  To change the default
customize the option `split-window-preferred-function'.
 
You can enforce this function to not split WINDOW vertically,
by setting (or binding) the variable `split-height-threshold' to
nil.  If, in addition, you set `split-width-threshold' to zero,
chances increase that this function does split WINDOW horizontally.
 
In order to not split WINDOW horizontally, set (or bind) the
variable `split-width-threshold' to nil.  Additionally, you can
set `split-height-threshold' to zero to make a vertical split
more likely to occur.
 
Have a look at the function `window-splittable-p' if you want to
know how `split-window-sensibly' determines whether WINDOW can be
split."
  (let ((window (or window (selected-window))))
    (or (and (window-splittable-p window t)
             ;; Split window horizontally.
             (with-selected-window window
               (split-window-right)))
        (and (window-splittable-p window)
             ;; Split window vertically.
             (with-selected-window window
               (split-window-below)))
        (and
         ;; If WINDOW is the only usable window on its frame (it is
         ;; the only one or, not being the only one, all the other
         ;; ones are dedicated) and is not the minibuffer window, try
         ;; to split it horizontally disregarding the value of
         ;; `split-width-threshold'.
         (let ((frame (window-frame window)))
           (or
            (eq window (frame-root-window frame))
            (catch 'done
              (walk-window-tree (lambda (w)
                                  (unless (or (eq w window)
                                              (window-dedicated-p w))
                                    (throw 'done nil)))
                                frame nil 'nomini)
              t)))
         (not (window-minibuffer-p window))
         (let ((split-width-threshold 0))
           (when (window-splittable-p window)
             (with-selected-window window
               (split-window-right))))))))
 
(setq split-window-preferred-function #'baal-split-window-sensibly)
 
(setq split-height-threshold nil
      split-width-threshold 120)
 
(defun baal-set-split-width-threshold (fn &rest args)
  (let ((split-width-threshold (* (frame-width) 0.55)))
    (apply fn args)))
 
(advice-add 'window-splittable-p :around #'baal-set-split-width-threshold)

To find all the spook words, edit this file.

(jcartwright@2403-4800-25af-b00--2) 192.168.1.5 etc  $ nano /usr/share/emacs/27.2/etc/spook.lines

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.