[Arcana] I feel dirty

Noah Friedman friedman at splode.com
Wed Nov 1 13:54:23 CST 2006

Surely this is not what "they" meant by introspection.

(defadvice switch-to-buffer-other-window (around sinit:p4hack activate)
  "Prevent p4.el commands from calling this godforsaken function and thus ignoring my same-window-regexps."
  (if (in-call-stack-p "^p4-")
      (display-buffer (ad-get-arg 0))

(defun in-call-stack-p (name)
    (let (f (i 0))
      (catch 'fish
        (while (setq f (backtrace-frame (setq i (1+ i))))
          (and (consp f)
               (symbolp (setq f (cadr f)))
               (if (symbolp name)
                   (eq f name)
                 (string-match name (symbol-name f)))
               (throw 'fish t)))))))

More information about the Arcana mailing list