decipher-stats-buffer)
;; Create a new buffer if requested:
(create
- (let ((stats-name (concat "*" (buffer-name) "*")))
+ (let* ((stats-name (concat "*" (buffer-name) "*"))
+ (buf (get-buffer stats-name)))
(setq decipher-stats-buffer
- (if (eq 'decipher-stats-mode
- (buffer-local-value 'major-mode
- (get-buffer stats-name)))
- ;; We just lost track of the statistics buffer:
- (get-buffer stats-name)
+ (if (and (bufferp buf)
+ (eq 'decipher-stats-mode
+ (buffer-local-value 'major-mode buf)))
+ buf
+ ;; We just lost track of the statistics buffer:
(generate-new-buffer stats-name))))
(with-current-buffer decipher-stats-buffer
(decipher-stats-mode))