[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54443: 29.0.50; decipher.el: (wrong-type-argument bufferp nil) when
From: |
Eli Zaretskii |
Subject: |
bug#54443: 29.0.50; decipher.el: (wrong-type-argument bufferp nil) when calling decipher-digram-list (and others) |
Date: |
Fri, 18 Mar 2022 10:31:27 +0200 |
> Date: Fri, 18 Mar 2022 07:37:44 +0000
> From: Simon Pugnet <simon@polaris64.net>
>
> I recently found out about the decipher package, but when trying it I
> get the following error: -
>
> Debugger entered--Lisp error: (wrong-type-argument bufferp nil)
> decipher-stats-buffer(t)
> decipher-analyze-buffer()
> decipher-analyze()
> decipher-digram-list()
> funcall-interactively(decipher-digram-list)
> command-execute(decipher-digram-list)
>
> To reproduce: -
>
> 1. emacs -Q
> 2. M-x decipher
> 3. Press D to call decipher-digram-list
Thanks. Does the patch below give good results?
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index ae44ecd..aeb4726 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -983,13 +983,14 @@ decipher-stats-buffer
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))