[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dismal f029f60: Use lexical-binding everywhere, and fix
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dismal f029f60: Use lexical-binding everywhere, and fix warnings |
Date: |
Thu, 20 May 2021 23:01:18 -0400 (EDT) |
branch: externals/dismal
commit f029f604bb6b6880d6628f02dc2332b235a8995f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Use lexical-binding everywhere, and fix warnings
* heaps.el: Use `cl-defstruct` and rename all functions to use
a `heaps-` prefix, so as not to conflict with the GNU ELPA `heap` lib.
Adjust all callers.
* dismal.el (dis-model-match, dis-model-match-op): Remove autoloads for
functions which don't seem used anywhere (and they probably don't work
anyway).
(dismal-version): Use `package-get-version`.
(dismal-version): Remove ineffective backslashes.
(global-map): Fix name of command bound to
`dismal-copy-to-dismal-binding`, which was renamed a long time ago.
(dismal-map-apply): Remove, use `mapc` everywhere instead.
* dismal-simple-menus.el: Use lexical-binding.
* dismal-mouse3.el: Use lexical-binding.
Silence warnings about functions provided by `dismal.el`.
* dismal-model-extensions.el: Use lexical-binding.
Require `dismal`.
(dis-model-matcher, dismal-adjust-range-list): Silence warnings.
(dis-model-match-op): Fix typo in function name.
* dismal-metacolumn.el: Use lexical-binding.
(dismal-redraw-range, dismal-insert-metacolumn-cells): Silence warnings.
(dis-align-metacolumns): Comment out unused vars `second-col-start`
and `second-col-end`.
* dismal-menu3.el:
* dismal-data-structures.el: Use lexical-binding.
---
dismal-data-structures.el | 6 +-
dismal-menu3.el | 10 +-
dismal-metacolumn.el | 29 ++--
dismal-model-extensions.el | 30 +++--
dismal-mouse3.el | 42 +++---
dismal-simple-menus.el | 4 +-
dismal.el | 325 +++++++++++++++++++++------------------------
heaps.el | 192 +++++++++++++-------------
keystroke.el | 10 +-
log.el | 8 +-
make-km-aliases.el | 12 +-
rmatrix.el | 4 +-
semi-coder.el | 6 +-
simple-menu.el | 30 ++---
vectors.el | 4 +-
15 files changed, 356 insertions(+), 356 deletions(-)
diff --git a/dismal-data-structures.el b/dismal-data-structures.el
index 742f32c..0af8c33 100644
--- a/dismal-data-structures.el
+++ b/dismal-data-structures.el
@@ -1,6 +1,6 @@
-;;; dismal-data-structures.el --- Misc data structures for Dismal
+;;; dismal-data-structures.el --- Misc data structures for Dismal -*-
lexical-binding: t; -*-
-;; Copyright (C) 1994, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
;; Author: Frank E. Ritter, ritter@cs.cmu.edu
;; Created-On: 14 May 94
@@ -137,7 +137,7 @@
;; put back in ;; 13-Jul-92 -FER, so qreplace can work on numbers
(numberp object)
(and (symbolp object) (boundp object)))
- (eval object)
+ (eval object t)
(prin1-to-string object)))
(defmacro dismal-mark-row ()
diff --git a/dismal-menu3.el b/dismal-menu3.el
index 7de6c4a..7fa007c 100644
--- a/dismal-menu3.el
+++ b/dismal-menu3.el
@@ -1,6 +1,6 @@
-;;; dismal-menu3.el --- Menu system for using with Dismal spreadsheet
+;;; dismal-menu3.el --- Menu system for using with Dismal spreadsheet -*-
lexical-binding: t; -*-
-;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
;; Author: Nigel Jenkins, nej@cs.nott.ac.uk
;; lpyjnej@psyc.nott.ac.uk
@@ -288,9 +288,9 @@
;;;
;; Remove other edit, since it contains dangerous commands.
-(define-key dismal-menu-map [edit] 'undefined)
-(define-key dismal-menu-map [search] 'undefined)
-(define-key dismal-menu-map [files] 'undefined)
+(define-key dismal-menu-map [edit] #'undefined)
+(define-key dismal-menu-map [search] #'undefined)
+(define-key dismal-menu-map [files] #'undefined)
(define-key dismal-menu-map [dedit]
(cons "dEdit" (make-sparse-keymap "Dis Edit")))
diff --git a/dismal-metacolumn.el b/dismal-metacolumn.el
index cae31c3..bbd2559 100644
--- a/dismal-metacolumn.el
+++ b/dismal-metacolumn.el
@@ -1,4 +1,4 @@
-;;; dismal-metacolumn.el --- Implement metacolumn manipulations for dismal
+;;; dismal-metacolumn.el --- Implement metacolumn manipulations for dismal
-*- lexical-binding: t; -*-
;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
@@ -73,6 +73,10 @@ at ROW (default, current-row)."
;;;; III. dis-insert-z-box
+;; FIXME: Unknown function!
+(declare-function dismal-redraw-range ":vaporware:")
+(declare-function dismal-insert-metacolumn-cells ":vaporware:")
+
(defun dis-insert-z-box (initial-arg)
"Insert ARG rows of cells on each side of dis-middle-col,
starting at the rows of point and mark, which must be on opposite
@@ -117,7 +121,8 @@ keeping other parts of the columns still aligned."
(r2c (dismal-mark-col))
first-row first-col-start first-col-end
;; these are used to do insertion
- second-row second-col-start second-col-end
+ second-row ;; second-col-start second-col-end
+
(arg (abs (- r1r r2r))) )
(if (not (or (and (<= r1c dis-middle-col) (> r2c dis-middle-col))
(and (<= r2c dis-middle-col) (> r1c dis-middle-col))))
@@ -132,24 +137,28 @@ keeping other parts of the columns still aligned."
(cond ((> r1c dis-middle-col) ;; point is left of mark
(setq first-col-start 0)
(setq first-col-end dis-middle-col)
- (setq second-col-start (1+ dis-middle-col))
- (setq second-col-end dismal-max-col))
+ ;; (setq second-col-start (1+ dis-middle-col))
+ ;; (setq second-col-end dismal-max-col)
+ )
(t ;; point is right of mark
(setq first-col-start (1+ dis-middle-col))
(setq first-col-end dismal-max-col)
- (setq second-col-start 0)
- (setq second-col-end dis-middle-col))))
+ ;; (setq second-col-start 0)
+ ;; (setq second-col-end dis-middle-col)
+ )))
(t (setq first-row r1r) (setq second-row r2r) ;; point is before
mark
(cond ((> r1c dis-middle-col) ;; point is left of mark
(setq first-col-start (1+ dis-middle-col))
(setq first-col-end dismal-max-col)
- (setq second-col-start 0)
- (setq second-col-end dis-middle-col))
+ ;; (setq second-col-start 0)
+ ;; (setq second-col-end dis-middle-col)
+ )
(t ;; point is right of mark
(setq first-col-start 0)
(setq first-col-end dis-middle-col)
- (setq second-col-start (1+ dis-middle-col))
- (setq second-col-end dismal-max-col)))))
+ ;; (setq second-col-start (1+ dis-middle-col))
+ ;; (setq second-col-end dismal-max-col)
+ ))))
(if dismal-interactive-p
(if (= first-col-start 0)
(message "Aligning row %s (R) to row %s (L)..." second-row
first-row)
diff --git a/dismal-model-extensions.el b/dismal-model-extensions.el
index 7504c61..2a8451e 100644
--- a/dismal-model-extensions.el
+++ b/dismal-model-extensions.el
@@ -1,4 +1,4 @@
-;;; dismal-model-extensions.el --- Specialized extensions to dismal
+;;; dismal-model-extensions.el --- Specialized extensions to dismal -*-
lexical-binding: t; -*-
;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
@@ -25,6 +25,12 @@
;;; Code:
+(require 'dismal)
+
+;; FIXME: This file uses functions that seem not to be defined anywhere.
+(declare-function dis-model-matcher ":vaporware:") ;It's in a comment, below.
+(declare-function dismal-adjust-range-list ":vaporware:")
+
;;;; I. model-match
(defun dis-model-match (range-list)
@@ -33,16 +39,16 @@ with something in colA-1. Only counts stuff that is in
order."
(interactive "P")
(setq range-list (dismal-adjust-range-list range-list))
(let* ((total 0) (matches 0))
- (dismal-do (function (lambda (row col old-result)
- (let ((dc (dismal-get-val row col))
- (mdc (dismal-get-val row (1- col))) )
- (setq total (if dc (1+ total) total))
- (setq matches
- (if (and dc mdc)
- (1+ matches)
- matches)))))
- range-list 0)
- (dis-div (float matches) (float total)) ))
+ (dismal-do (lambda (row col _old-result)
+ (let ((dc (dismal-get-val row col))
+ (mdc (dismal-get-val row (1- col))) )
+ (setq total (if dc (1+ total) total))
+ (setq matches
+ (if (and dc mdc)
+ (1+ matches)
+ matches))))
+ range-list 0)
+ (dis-div (float matches) (float total)) ))
;; these are not easily combined with the function abov
(defun dis-model-match-op (range-list)
@@ -50,7 +56,7 @@ with something in colA-1. Only counts stuff that is in
order."
with something in colA-2, and col A is an operator. Only counts stuff
that is in order."
(interactive "P")
- (model-matcher range-list "O: "))
+ (dis-model-matcher range-list "O: "))
;; (defun dis-model-matcher (range-list string-test)
;; (setq range-list (dismal-adjust-range-list range-list))
diff --git a/dismal-mouse3.el b/dismal-mouse3.el
index 57420d1..2e4afa5 100644
--- a/dismal-mouse3.el
+++ b/dismal-mouse3.el
@@ -1,6 +1,6 @@
-;;; dismal-mouse3.el --- Functionality for using a mouse inside of Dismal
+;;; dismal-mouse3.el --- Functionality for using a mouse inside of Dismal -*-
lexical-binding: t; -*-
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
;; Author: Nigel Jenkins, nej@cs.nott.ac.uk
;; lpyjnej@psyc.nott.ac.uk
@@ -34,6 +34,18 @@
(defvar dismal-max-row)
(defvar dismal-current-row)
+;; FIXME: We have a circularity between `dismal.el' and `dismal-mouse3.el'.
+;; We should probably move the functions needed by `dismal-mouse3.el'
+;; into a new `dismal-lib.el' to break this cycle.
+;; In the mean time, just silence the warnings.
+(declare-function dismal-column-width "dismal")
+(declare-function dismal-goto-column "dismal")
+(declare-function dismal-goto-row "dismal")
+(declare-function dismal-set-mark "dismal")
+(declare-function dismal-jump-to-cell "dismal")
+(declare-function dismal-cell-name "dismal")
+(declare-function dismal-raw-column-to-dismal-column "dismal")
+
;;;; i. Modify `dismal-mode-map' to cope with new mouse controls
;; Keymap additions to dismal-mode-map keymap, allowing the mouse to
@@ -41,26 +53,26 @@
(defvar dismal-mouse-map
(let ((map (make-sparse-keymap)))
- (define-key map [down-mouse-1] 'dis-mouse-highlight-cell-or-range)
- (define-key map [double-mouse-1] 'ignore)
- (define-key map [triple-mouse-1] 'ignore)
+ (define-key map [down-mouse-1] #'dis-mouse-highlight-cell-or-range)
+ (define-key map [double-mouse-1] #'ignore)
+ (define-key map [triple-mouse-1] #'ignore)
;; These areecause of how the matrix is represented,
;; so don't r.
- ;; (define-kde-map [down-mouse-2] 'dis-mouse-highlight-column)
- ;; (define-kde-map [mouse-2] 'dis-mouse-highlight-column)
+ ;; (define-kde-map [down-mouse-2] #'dis-mouse-highlight-column)
+ ;; (define-kde-map [mouse-2] #'dis-mouse-highlight-column)
;; had been t-point, which is a mess with plain text
- (define-key map [down-mouse-2] 'dis-mouse-highlight-cell-or-range)
- (define-key map [mouse-2] 'dis-mouse-highlight-cell-or-range)
- (define-key map [double-mouse-2] 'ignore)
- (define-key map [triple-mouse-2] 'ignore)
+ (define-key map [down-mouse-2] #'dis-mouse-highlight-cell-or-range)
+ (define-key map [mouse-2] #'dis-mouse-highlight-cell-or-range)
+ (define-key map [double-mouse-2] #'ignore)
+ (define-key map [triple-mouse-2] #'ignore)
- (define-key map [down-mouse-3] 'dis-mouse-highlight-row)
- (define-key map [mouse-3] 'dis-mouse-highlight-row)
- (define-key map [double-mouse-3] 'ignore)
- (define-key map [triple-mouse-3] 'ignore)
+ (define-key map [down-mouse-3] #'dis-mouse-highlight-row)
+ (define-key map [mouse-3] #'dis-mouse-highlight-row)
+ (define-key map [double-mouse-3] #'ignore)
+ (define-key map [triple-mouse-3] #'ignore)
map))
diff --git a/dismal-simple-menus.el b/dismal-simple-menus.el
index 5575d38..0e2c25f 100644
--- a/dismal-simple-menus.el
+++ b/dismal-simple-menus.el
@@ -1,6 +1,6 @@
-;;; dismal-simple-menus.el --- Describe the simple-menus in dismal-mode
+;;; dismal-simple-menus.el --- Describe the simple-menus in dismal-mode -*-
lexical-binding: t; -*-
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
;; Author: Frank Ritter
;; Created-On: Mon Jan 6 21:19:01 1992
diff --git a/dismal.el b/dismal.el
index 0d2fd00..e289dcd 100644
--- a/dismal.el
+++ b/dismal.el
@@ -7,7 +7,7 @@
;; Maintainer: UnMaintainer <emacs-devel@gnu.org>
;; Created-On: 31 Oct 1991.
;; Version: 1.5.2
-;; Package-Requires: ((cl-lib "0"))
+;; Package-Requires: ((cl-lib "0") (emacs "24.3"))
;; This is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -212,7 +212,7 @@ columns when alighning.")
confirmed on entering.")
(defvar dismal-copy-to-dismal-binding "\C-c\M-c"
- "*Key to globally bind to `copy-to-dismal'.")
+ "*Key to globally bind to `dis-copy-to-dismal'.")
(defconst dismal-directory (file-name-directory load-file-name))
@@ -274,50 +274,50 @@ confirmed on entering.")
;; could del work appropriately?
;; box keys first
- (define-key map [begin] 'dis-first-column)
- (define-key map [up] 'dis-backward-row)
- (define-key map [down] 'dis-forward-row)
- (define-key map [left] 'dis-backward-column)
- (define-key map [right] 'dis-forward-column)
- (define-key map [home] 'dis-first-column)
- (define-key map [C-home] 'dis-beginning-of-buffer)
- (define-key map [end] 'dis-end-of-row)
- (define-key map [C-end] 'dis-end-of-buffer)
- (define-key map [prior] 'dis-scroll-down-in-place)
- (define-key map [next] 'dis-scroll-up-in-place)
- (define-key map "\t" 'dis-forward-column)
+ (define-key map [begin] #'dis-first-column)
+ (define-key map [up] #'dis-backward-row)
+ (define-key map [down] #'dis-forward-row)
+ (define-key map [left] #'dis-backward-column)
+ (define-key map [right] #'dis-forward-column)
+ (define-key map [home] #'dis-first-column)
+ (define-key map [C-home] #'dis-beginning-of-buffer)
+ (define-key map [end] #'dis-end-of-row)
+ (define-key map [C-end] #'dis-end-of-buffer)
+ (define-key map [prior] #'dis-scroll-down-in-place)
+ (define-key map [next] #'dis-scroll-up-in-place)
+ (define-key map "\t" #'dis-forward-column)
;; plain keys now
- (define-key map "?" 'describe-mode)
- (define-key map "<" 'dis-edit-cell-leftjust)
- (define-key map ">" 'dis-edit-cell-rightjust)
- ;; (define-key map "\"" 'dis-edit-cell-string)
- ;; (define-key map "'" 'dis-edit-cell-string)
- (define-key map "=" 'dis-edit-cell-default)
- (define-key map "|" 'dis-edit-cell-center)
- (define-key map "\ " 'dis-forward-column)
- (define-key map "c" 'dis-copy-range)
- (define-key map "dc" 'dis-delete-column)
- (define-key map "dd" 'dis-delete-range)
- (define-key map "dr" 'dis-delete-row)
- (define-key map "d " 'dis-delete-blank-rows)
- (define-key map "e" 'dis-edit-cell-plain)
- (define-key map "f" 'dis-read-column-format)
- (define-key map "h" 'dis-help)
- (define-key map "ic" 'dis-insert-column)
- (define-key map "ii" 'dis-insert-range)
- (define-key map "iz" 'dis-insert-z-box)
- (define-key map "i." 'dis-insert-cells)
- (define-key map "ir" 'dis-insert-row)
- (define-key map "j" 'dis-jump)
- (define-key map "m" 'dis-set-mark)
- (define-key map "n" 'dis-next-filled-row-cell)
- (define-key map "p" 'dis-previous-filled-row-cell)
- (define-key map "q" 'dis-bury-buffer)
- (define-key map "r" 'dis-hard-redraw-row)
- (define-key map "v" 'dis-paste-range)
- (define-key map "x" 'dis-kill-range)
- (define-key map "z" 'dis-redraw-range)
+ (define-key map "?" #'describe-mode)
+ (define-key map "<" #'dis-edit-cell-leftjust)
+ (define-key map ">" #'dis-edit-cell-rightjust)
+ ;;(define-key map "\"" #'dis-edit-cell-string)
+ ;;(define-key map "'" #'dis-edit-cell-string)
+ (define-key map "=" #'dis-edit-cell-default)
+ (define-key map "|" #'dis-edit-cell-center)
+ (define-key map "\ " #'dis-forward-column)
+ (define-key map "c" #'dis-copy-range)
+ (define-key map "dc" #'dis-delete-column)
+ (define-key map "dd" #'dis-delete-range)
+ (define-key map "dr" #'dis-delete-row)
+ (define-key map "d " #'dis-delete-blank-rows)
+ (define-key map "e" #'dis-edit-cell-plain)
+ (define-key map "f" #'dis-read-column-format)
+ (define-key map "h" #'dis-help)
+ (define-key map "ic" #'dis-insert-column)
+ (define-key map "ii" #'dis-insert-range)
+ (define-key map "iz" #'dis-insert-z-box)
+ (define-key map "i." #'dis-insert-cells)
+ (define-key map "ir" #'dis-insert-row)
+ (define-key map "j" #'dis-jump)
+ (define-key map "m" #'dis-set-mark)
+ (define-key map "n" #'dis-next-filled-row-cell)
+ (define-key map "p" #'dis-previous-filled-row-cell)
+ (define-key map "q" #'dis-bury-buffer)
+ (define-key map "r" #'dis-hard-redraw-row)
+ (define-key map "v" #'dis-paste-range)
+ (define-key map "x" #'dis-kill-range)
+ (define-key map "z" #'dis-redraw-range)
;; C-j newline-and-indent should goto work better
;; C-o should work appropriately
@@ -327,48 +327,48 @@ confirmed on entering.")
;; C-x [ and C- ] (paging) should work appropriately
;; C-x > C-x < scroll right & left
- (define-key map "\C-?" 'dis-backward-kill-cell) ;del
+ (define-key map "\C-?" #'dis-backward-kill-cell) ;del
;; very tricky key definition follows, allowing C-space to work:
- (define-key map [?\C-\ ] 'dis-set-mark)
- (define-key map "\C-@" 'dis-set-mark)
- (define-key map "\C-a" 'dis-first-column)
- (define-key map "\C-b" 'dis-backward-column)
- (define-key map "\C-c\C-m" 'dis-run-menu)
+ (define-key map [?\C-\ ] #'dis-set-mark)
+ (define-key map "\C-@" #'dis-set-mark)
+ (define-key map "\C-a" #'dis-first-column)
+ (define-key map "\C-b" #'dis-backward-column)
+ (define-key map "\C-c\C-m" #'dis-run-menu)
;; something binds it to insert mail buffer, which is dangerous
- (define-key map "\C-cm" 'undefined)
- (define-key map "\C-d" 'dis-clear-cell)
- (define-key map "\C-e" 'dis-end-of-row)
- (define-key map "\C-f" 'dis-forward-column)
- (define-key map "\C-k" 'dis-kill-line)
+ (define-key map "\C-cm" #'undefined)
+ (define-key map "\C-d" #'dis-clear-cell)
+ (define-key map "\C-e" #'dis-end-of-row)
+ (define-key map "\C-f" #'dis-forward-column)
+ (define-key map "\C-k" #'dis-kill-line)
;; this appears to be too slow, leave as plain recenter
- ;;(define-key map "\C-l" 'dis-recenter)
- (define-key map "\C-m" 'dis-forward-row)
- (define-key map "\C-n" 'dis-forward-row)
- (define-key map "\C-o" 'dis-open-line)
- (define-key map "\C-p" 'dis-backward-row)
- (define-key map "\C-r" 'dis-isearch-backwards)
- (define-key map "\C-s" 'dis-isearch)
- (define-key map "\C-t" 'undefined) ; transpose-chars
- (define-key map "\C-q" 'dis-quoted-insert)
- (define-key map "\C-w" 'dis-kill-range)
- (define-key map "\C-xu" 'dis-undo)
- (define-key map "\C-_" 'dis-undo)
- (define-key map "\C-v" 'dis-scroll-up-in-place)
+ ;;(define-key map "\C-l" #'dis-recenter)
+ (define-key map "\C-m" #'dis-forward-row)
+ (define-key map "\C-n" #'dis-forward-row)
+ (define-key map "\C-o" #'dis-open-line)
+ (define-key map "\C-p" #'dis-backward-row)
+ (define-key map "\C-r" #'dis-isearch-backwards)
+ (define-key map "\C-s" #'dis-isearch)
+ (define-key map "\C-t" #'undefined) ; transpose-chars
+ (define-key map "\C-q" #'dis-quoted-insert)
+ (define-key map "\C-w" #'dis-kill-range)
+ (define-key map "\C-xu" #'dis-undo)
+ (define-key map "\C-_" #'dis-undo)
+ (define-key map "\C-v" #'dis-scroll-up-in-place)
;; FIXME: Abuses C-x bindings!
- (define-key map "\C-xi" 'dis-insert-file)
- (define-key map "\C-x\C-i" 'dis-insert-file)
- (define-key map "\C-xr" 'dis-update-ruler)
- ;; (define-key map "\C-xs" 'dis-save-some-buffers)
- (define-key map "\C-x\C-s" 'dis-save-file)
- (define-key map "\C-x\C-w" 'dis-write-file)
- (define-key map "\C-x\C-x" 'dis-exchange-point-and-mark)
- (define-key map "\C-x[" 'dis-start-of-col)
- (define-key map "\C-x]" 'dis-end-of-col)
- (define-key map "\C-x>" 'undefined) ; set-fill-prefix
- (define-key map "\C-x\C-q" 'dis-toggle-read-only)
- (define-key map "\C-y" 'dis-paste-range)
-
- (define-key map "\C-c\M-\C-c" 'dis-op-code-segment)
+ (define-key map "\C-xi" #'dis-insert-file)
+ (define-key map "\C-x\C-i" #'dis-insert-file)
+ (define-key map "\C-xr" #'dis-update-ruler)
+ ;; (define-key map "\C-xs" #'dis-save-some-buffers)
+ (define-key map "\C-x\C-s" #'dis-save-file)
+ (define-key map "\C-x\C-w" #'dis-write-file)
+ (define-key map "\C-x\C-x" #'dis-exchange-point-and-mark)
+ (define-key map "\C-x[" #'dis-start-of-col)
+ (define-key map "\C-x]" #'dis-end-of-col)
+ (define-key map "\C-x>" #'undefined) ; set-fill-prefix
+ (define-key map "\C-x\C-q" #'dis-toggle-read-only)
+ (define-key map "\C-y" #'dis-paste-range)
+
+ (define-key map "\C-c\M-\C-c" #'dis-op-code-segment)
;; M-a should work appropriately
;; M-m back-to-indentation should work appropriately
;; M-r replace-string should work appropriately
@@ -376,46 +376,46 @@ confirmed on entering.")
;; M-z down-one-line
;; M-del should work appropriately?
- (define-key map "\M-\C-?" 'dis-backward-kill-cell) ;del
- (define-key map "\M-\ " 'dis-backward-column)
- (define-key map "\M-<" 'dis-beginning-of-buffer)
- (define-key map "\M->" 'dis-end-of-buffer)
- (define-key map "\M-[" 'undefined) ;
- (define-key map "\M-]" 'undefined) ; not bound
- (define-key map "\M-\t" 'dis-backward-column)
- (define-key map "\M-a" 'undefined) ; backward-sentence
- (define-key map "\M-b" 'dis-backward-filled-column)
- (define-key map "\M-c" 'dis-capitalize-cell)
- (define-key map "\M-d" 'dis-kill-cell)
- (define-key map "\M-e" 'dis-last-column)
- (define-key map "\M-f" 'dis-forward-filled-column)
- (define-key map "\M-g" 'undefined) ; fill-region
- (define-key map "\M-h" 'undefined) ; mark-paragraph
- (define-key map "\M-i" 'undefined) ; tab-to-tab-stop
- (define-key map "\M-j" 'dis-align-metacolumns) ; fill-paragraph
- (define-key map "\M-k" 'undefined) ; kill-sent
- (define-key map "\M-l" 'dis-downcase-cell)
- (define-key map "\M-n" 'dis-next-filled-row-cell)
- (define-key map "\M-o" 'dis-insert-range)
- (define-key map "\M-p" 'dis-previous-filled-row-cell)
- (define-key map "\M-q" 'dis-query-replace)
+ (define-key map "\M-\C-?" #'dis-backward-kill-cell) ;del
+ (define-key map "\M-\ " #'dis-backward-column)
+ (define-key map "\M-<" #'dis-beginning-of-buffer)
+ (define-key map "\M->" #'dis-end-of-buffer)
+ (define-key map "\M-[" #'undefined) ;
+ (define-key map "\M-]" #'undefined) ; not bound
+ (define-key map "\M-\t" #'dis-backward-column)
+ (define-key map "\M-a" #'undefined) ; backward-sentence
+ (define-key map "\M-b" #'dis-backward-filled-column)
+ (define-key map "\M-c" #'dis-capitalize-cell)
+ (define-key map "\M-d" #'dis-kill-cell)
+ (define-key map "\M-e" #'dis-last-column)
+ (define-key map "\M-f" #'dis-forward-filled-column)
+ (define-key map "\M-g" #'undefined) ; fill-region
+ (define-key map "\M-h" #'undefined) ; mark-paragraph
+ (define-key map "\M-i" #'undefined) ; tab-to-tab-stop
+ (define-key map "\M-j" #'dis-align-metacolumns) ; fill-paragraph
+ (define-key map "\M-k" #'undefined) ; kill-sent
+ (define-key map "\M-l" #'dis-downcase-cell)
+ (define-key map "\M-n" #'dis-next-filled-row-cell)
+ (define-key map "\M-o" #'dis-insert-range)
+ (define-key map "\M-p" #'dis-previous-filled-row-cell)
+ (define-key map "\M-q" #'dis-query-replace)
;; used to be replace-string
- (define-key map "\M-r" 'dis-move-to-window-line)
- (define-key map "\M-t" 'dis-transpose-cells) ;used 2be transpose-words
- (define-key map "\M-u" 'dis-upcase-cell)
- (define-key map "\M-v" 'dis-scroll-down-in-place)
- (define-key map "\M-w" 'dis-copy-range)
- (define-key map "\M-=" 'dis-debug-cell)
- (define-key map "\M-%" 'dis-query-replace)
- (define-key map "\M-," 'undefined) ; tags-loop-continue
+ (define-key map "\M-r" #'dis-move-to-window-line)
+ (define-key map "\M-t" #'dis-transpose-cells) ;used 2be transpose-words
+ (define-key map "\M-u" #'dis-upcase-cell)
+ (define-key map "\M-v" #'dis-scroll-down-in-place)
+ (define-key map "\M-w" #'dis-copy-range)
+ (define-key map "\M-=" #'dis-debug-cell)
+ (define-key map "\M-%" #'dis-query-replace)
+ (define-key map "\M-," #'undefined) ; tags-loop-continue
;; C-M-b, f, a, & e should work appropriately
- (define-key map "\M-\C-k" 'undefined) ;kill-sexp
- (define-key map "\M-\C-e" 'dis-erase-range)
- (define-key map "\M-\C-m" 'dis-backward-row)
- (define-key map "\M-\C-r" 'dis-redraw)
- (define-key map "\M-\C-t" 'dis-transpose-cells) ; used to be
transpose-sexps
- (define-key map "\M-\C-u" 'dis-update-matrix) ; used to be backward-up-list
+ (define-key map "\M-\C-k" #'undefined) ;kill-sexp
+ (define-key map "\M-\C-e" #'dis-erase-range)
+ (define-key map "\M-\C-m" #'dis-backward-row)
+ (define-key map "\M-\C-r" #'dis-redraw)
+ (define-key map "\M-\C-t" #'dis-transpose-cells) ;used to be
transpose-sexps
+ (define-key map "\M-\C-u" #'dis-update-matrix) ; used to be
backward-up-list
;; dis-recalculate-matrix
map)
"Keymap for Dismal mode.")
@@ -460,28 +460,11 @@ keeping other parts of the columns still aligned.")
;; can't require this (it has no provide), but we'll try
(autoload 'delete-extract-rectangle "rect")
-(autoload 'dis-model-match "dismal-extensions"
- "Given a cell RANGE computes the percentage of colA matched
-with something in colA-1. Only counts stuff that is in order." t)
-
-(autoload 'dis-model-match-op "dismal-extensions"
- "Given a cell RANGE computes the percentage of colA matched
-with something in colA-2, and col A is an operator. Only counts stuff
-that is in order." t)
(autoload 'dis-auto-align-model "auto-aligner"
"Automatically align the two metacolumns in
the spreadsheet." t)
-(autoload 'dis-model-match-op "dismal-model-extensions"
- "Given a cell RANGE computes the percentage of colA matched
-with something in colA-2, and col A is an operator. Only counts stuff
-that is in order." t)
-
-(autoload 'dis-model-match "dismal-model-extensions"
- "Given a cell RANGE computes the percentage of colA matched
-with something in colA-1. Only counts stuff that is in order." t)
-
(autoload 'dis-initialize-operator-codes "semi-coder"
"Initialize the dismal operator codes." t)
@@ -524,15 +507,16 @@ with something in colA-1. Only counts stuff that is in
order." t)
;;;; viii. System Constants
-(defconst dismal-version "1.4"
- "Version of dismal-mode implementation.")
+(defconst dismal-version
+ (if (fboundp 'package-get-version) (package-get-version) "unknown")
+ "Version of dismal-mode package.")
(defun dismal-version (&optional here)
"Show the version of dismal.el in the minibuffer.
If optional argument HERE is non-nil, insert info at point."
(interactive "P")
(let ((version-string
- (format "Version of \`dismal.el\': %s" dismal-version)))
+ (format "Version of `dismal.el': %s" dismal-version)))
(if here
(insert version-string)
(if (called-interactively-p 'interactive)
@@ -1211,8 +1195,8 @@ and right mouse button is bound to
`dis-mouse-highlight-row'.
(setq mode-line-format dismal-mode-line-format)
;; must be set in all buffers
(setq dismal-matrix (dismal-create-matrix))
- (setq dismal-invalid-heapA (heap-create 'dismal-address-compare))
- (setq dismal-invalid-heapB (heap-create 'dismal-address-compare))
+ (setq dismal-invalid-heapA (heaps-create #'dismal-address-compare))
+ (setq dismal-invalid-heapB (heaps-create #'dismal-address-compare))
(setq dismal-invalid-heap dismal-invalid-heapA)
(setq dismal-invalid-heap-not dismal-invalid-heapB)
(setq dismal-range-buffer [0 0 0])
@@ -1552,8 +1536,8 @@ C-x C-q to change read-only.")))
;; This is used outside of dismal, so must rebind.
(cond
((not (key-binding dismal-copy-to-dismal-binding))
- (global-set-key dismal-copy-to-dismal-binding 'copy-to-dismal))
- ((eq (key-binding dismal-copy-to-dismal-binding) 'copy-to-dismal))
+ (global-set-key dismal-copy-to-dismal-binding #'dis-copy-to-dismal))
+ ((eq (key-binding dismal-copy-to-dismal-binding) #'dis-copy-to-dismal))
(t (message
"Change value of dismal-copy-to-dismal-binding, %s already used as %s"
(key-description dismal-copy-to-dismal-binding)
@@ -1563,12 +1547,12 @@ C-x C-q to change read-only.")))
(defvar dismal-minibuffer-local-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
- (define-key map "\C-j" 'dismal-exit-minibuffer-down)
- (define-key map "\C-m" 'exit-minibuffer)
- (define-key map "\C-n" 'dismal-exit-minibuffer-down)
- (define-key map "\C-p" 'dismal-exit-minibuffer-up)
- ;; (define-key map "\M-\C-b" 'dismal-exit-minibuffer-left)
- ;; (define-key map "\M-\C-f" 'dismal-exit-minibuffer-right)
+ (define-key map "\C-j" #'dismal-exit-minibuffer-down)
+ (define-key map "\C-m" #'exit-minibuffer)
+ (define-key map "\C-n" #'dismal-exit-minibuffer-down)
+ (define-key map "\C-p" #'dismal-exit-minibuffer-up)
+ ;; (define-key map "\M-\C-b" #'dismal-exit-minibuffer-left)
+ ;; (define-key map "\M-\C-f" #'dismal-exit-minibuffer-right)
map))
(defun dismal-exit-minibuffer-down ()
@@ -2515,13 +2499,12 @@ in the status line."
;; does not keep point and mark clean in original buffer
;; does not keep point and mark clean in dismal buffer
(defun dis-copy-to-dismal (dismal-buffer-name beg end)
-
"Copy column specified by point and mark to buffer DISMAL-BUFFER-NAME
starting at its current cell. Point and mark must be within or at the
beginning of a column of text, delimited by blanks. The column must
contain words without spaces or valid dismal numbers, which may
contain decimal points but not commas. The variable
-dis-copy-column-seperator (default is space) is used to separate columns.
+`dis-copy-column-separator' (default is space) is used to separate columns.
For example, in the following column, you would place point on 2 in
123 and mark on the 8 in 789 and only that middle column would be
@@ -2800,7 +2783,7 @@ current cell's value."
(vector-remove dismal-formula-cells (cons row column))
(dismal-set-mrk row column nil)
;; invalidate its references if its just a value
- (dismal-map-apply 'dismal-invalidate-cell (dismal-get-deps row column))))
+ (mapc #'dismal-invalidate-cell (dismal-get-deps row column))))
(defun dis-capitalize-cell (arg)
"Capitalize the current cell (or ARG cells), moving over if arg >1 (default).
@@ -2868,25 +2851,25 @@ This gives the cell(s) characters all in upper case."
(let ((temp nil)
(i 1))
(while (and (<= i dis-iteration-limit)
- (not (heap-empty-p dismal-invalid-heap)))
+ (not (heaps-empty-p dismal-invalid-heap)))
(message "Starting to update cycle ... %d (%s cells)" i
- (heap-last dismal-invalid-heap))
+ (heaps-size dismal-invalid-heap))
(dismal-update-cycle)
(setq i (1+ i))
(setq temp dismal-invalid-heap)
(setq dismal-invalid-heap dismal-invalid-heap-not)
(setq dismal-invalid-heap-not temp))
;; check to see how long you did this...
- (if (not (heap-empty-p dismal-invalid-heap))
+ (if (not (heaps-empty-p dismal-invalid-heap))
(message "Update stopped due to exceeding max cycles of %s."
dis-iteration-limit)
(message "Updated %s times." (1- i)) ) ))
-;; (heap-aref dismal-invalid-heap 0)
+;; (heaps--aref dismal-invalid-heap 0)
(defun dismal-update-cycle ()
(let ((prev nil))
- (while (not (heap-empty-p dismal-invalid-heap))
- (let* ((addr (heap-deletemin dismal-invalid-heap))
+ (while (not (heaps-empty-p dismal-invalid-heap))
+ (let* ((addr (heaps-deletemin dismal-invalid-heap))
(r (dismal-address-row addr))
(c (dismal-address-col addr))
(new-val nil)
@@ -2912,14 +2895,14 @@ This gives the cell(s) characters all in upper case."
;;(message "invalidating %s %s" r c)
;; only invalidate cells that can be updated
(if (vector-member dismal-formula-cells addr)
- (heap-insert dismal-invalid-heap addr)
+ (heaps-insert dismal-invalid-heap addr)
(dismal-redraw-cell r c t))
;;is this necessary? seems to lead to problems...
;;(dismal-set-val row col nil)
(if (eq 'visited (dismal-get-mrk r c))
()
(dismal-set-mrk r c 'visited)
- (dismal-map-apply #'dismal-invalidate-cell (dismal-get-deps r c))
+ (mapc #'dismal-invalidate-cell (dismal-get-deps r c))
(dismal-set-mrk r c 0))))
(defun dis-recalculate-matrix ()
@@ -2934,8 +2917,8 @@ This gives the cell(s) characters all in upper case."
;; (sit-for 1)
(if (dismal-possible-live-sexp
(dismal-get-exp (car cell) (cadr cell)))
- (heap-insert dismal-invalid-heap
- (cons (car cell) (cadr cell)))))
+ (heaps-insert dismal-invalid-heap
+ (cons (car cell) (cadr cell)))))
dismal-matrix)
(dis-update-matrix)
(dis-redraw nil))
@@ -3025,9 +3008,9 @@ If range is 2d, signal an error."
-;;;; EMA changes ;;; EMA changes ;;; EMA changes ;;; EMA changes
-;;;; inserting and deleting rows throws off formulas.
-;;;; same sort of fix might be needed for columns. changes are marked
+;; EMA changes ;;; EMA changes ;;; EMA changes ;;; EMA changes
+;; inserting and deleting rows throws off formulas.
+;; same sort of fix might be needed for columns. changes are marked
;; 3-7-93 - EMA - didn't remove the call to dismal-change-row-references.
;; see dismal-insert-range-cells.
@@ -3058,7 +3041,7 @@ If range is 2d, signal an error."
(setq dismal-max-row (+ dismal-max-row arg))
(dis-insert-cells arg (if (not (aref dismal-mark 0)) 'rows)))
-;;; Special case: insert whole row
+;; Special case: insert whole row
((and (= start-row end-row)
(= start-col 0) (= end-col dismal-max-col))
(setq dismal-max-row (+ dismal-max-row arg))
@@ -3070,7 +3053,7 @@ If range is 2d, signal an error."
;;(dismal-change-row-references dismal-current-row arg)
)
-;;; Insert partial row moving cells down
+;; Insert partial row moving cells down
((= start-row end-row)
(setq dismal-max-row (+ dismal-max-row arg))
(while (<= start-col end-col)
@@ -3085,7 +3068,7 @@ If range is 2d, signal an error."
(1+ dismal-max-row)))
(dismal-add-row-labels-at-end arg))
-;;; Special case: insert whole column
+;; Special case: insert whole column
((and (= start-col end-col)
(= start-row 0) (= end-row dismal-max-row))
(setq dismal-max-col (+ dismal-max-col arg))
@@ -5726,12 +5709,6 @@ Includes leap years."
;;;; XIXb. Utility functions - List functions
-(defun dismal-map-apply (function list)
- (if (null list)
- ()
- (funcall function (car list))
- (dismal-map-apply function (cdr list))))
-
;; (setq aa '(1 2 (1 . 2) 3 4))
;; (dismal-del 1 aa)
;; (dismal-del '(1 . 2) aa)
diff --git a/heaps.el b/heaps.el
index 29eb10f..0e4bd31 100644
--- a/heaps.el
+++ b/heaps.el
@@ -1,4 +1,4 @@
-;;; heaps.el --- Some kind of heap data structure of Dismal
+;;; heaps.el --- Some kind of heap data structure of Dismal -*-
lexical-binding: t; -*-
;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
@@ -33,156 +33,144 @@
;; element-vector]
;;
;; Entry points:
-;; (heap-create compare-function) - create an empty heap
-;; (heap-insert heap element) - insert an element
-;; (heap-deletemin heap) - delete and return smallest
-;; (heap-empty heap) - empty heap predicate
-;; (heap-space heap) - amount of space in heap
-;; (heap-last heap) - amount of space used,
-;; address of last element
-
-(defsubst heap-compare (h a b)
- "Use HEAP's compare function to compare elements A and B.
-Argument H "
- (funcall (aref h 0) a b))
-
-(defsubst heap-space (h)
- "Return the amount of space available in HEAP's vector."
- (aref h 1))
-
-(defsubst heap-last (h)
- "Return the index of the element after the HEAP's last element."
- (aref h 2))
-
-(defsubst heap-set-space (h v) (aset h 1 v))
-(defsubst heap-set-last (h v) (aset h 2 v))
-
-(defsubst heap-aref (h n)
+;; (heaps-create compare-function) - Create an empty heap
+;; (heaps-insert heap element) - Insert an element
+;; (heaps-deletemin heap) - Delete and return smallest
+;; (heaps-empty-p heap) - Empty heap predicate
+;; (heaps-size heap) - Number of elements in the heap
+
+(cl-defstruct (heaps
+ (:conc-name heaps--)
+ (:constructor nil)
+ (:constructor heaps-create (compare-function)))
+ compare-function
+ (space 1)
+ (last 0)
+ (elems (make-vector 1 nil)))
+
+(defsubst heaps--compare (h a b)
+ "Use HEAP's compare function to compare elements A and B."
+ (funcall (heaps--compare-function h) a b))
+
+(defalias 'heaps-size #'heaps--last
+ "Number of elements in the heap.")
+
+(defsubst heaps--aref (h n)
"Return the HEAP's Nth element."
- (aref (aref h 3) n))
+ (declare (gv-expander (lambda (do)
+ (macroexp-let2 nil v `(heaps--elems ,h)
+ (macroexp-let2 nil n n
+ (gv-get `(aref ,v ,n) do))))))
+ (aref (heaps--elems h) n))
-(defsubst heap-aset (h n v)
- "Set the HEAP's Nth element to V."
- (aset (aref h 3) n v))
-
-(defsubst heap-empty-p (h)
+(defsubst heaps-empty-p (h)
"Return non-nil iff HEAP is empty."
- (= (heap-last h) 0))
-(define-obsolete-function-alias 'heap-empty 'heap-empty-p "Dismal-1.5")
+ (= (heaps--last h) 0))
-(defsubst heap-swap (h i j)
+(defsubst heaps--swap (h i j)
"Swap HEAP's I'th and J'th elements."
- (let ((elem1 (heap-aref h i))
- (elem2 (heap-aref h j)))
- (heap-aset h i elem2)
- (heap-aset h j elem1)))
-
-(defun heap-create (compare-function)
- "Create an empty priority queue (heap) with the given COMPARE-FUNCTION."
- (let ((heap (make-vector 4 nil)))
- (aset heap 0 compare-function)
- (heap-set-space heap 1)
- (heap-set-last heap 0)
- (aset heap 3 (make-vector 1 nil))
- heap))
-
-(defun heap--bubble-up (heap index)
- "Helping function for `heap-insert'."
+ (let ((elem1 (heaps--aref h i))
+ (elem2 (heaps--aref h j)))
+ (setf (heaps--aref h i) elem2)
+ (setf (heaps--aref h j) elem1)))
+
+(defun heaps--bubble-up (heap index)
+ "Helping function for `heaps-insert'."
(let* ((half (/ (1- index) 2))
- (elem (heap-aref heap index))
- (parent (heap-aref heap half))
- (comp (heap-compare heap parent elem)))
+ (elem (heaps--aref heap index))
+ (parent (heaps--aref heap half))
+ (comp (heaps--compare heap parent elem)))
(if (<= comp 0)
()
- (heap-aset heap index parent)
- (heap-aset heap half elem)
+ (setf (heaps--aref heap index) parent)
+ (setf (heaps--aref heap half) elem)
(if (> index 0)
- (heap--bubble-up heap half)))))
+ (heaps--bubble-up heap half)))))
-(defsubst heap-insert (heap element)
- "Usage: (heap-insert heap element) Insert ELEMENT into HEAP."
+(defsubst heaps-insert (heap element)
+ "Insert ELEMENT into HEAP."
;; if there is no space, grow the heap doubling it
- (if (= (heap-space heap) (heap-last heap))
+ (if (= (heaps--space heap) (heaps--last heap))
(progn
- (aset heap 3 (vconcat (aref heap 3)
- (make-vector (heap-space heap) nil)))
- (heap-set-space heap (+ (heap-space heap)
- (heap-space heap)))))
+ (cl-callf (lambda (x) (vconcat x (make-vector (heaps--space heap)
nil)))
+ (heaps--elems heap))
+ (setf (heaps--space heap) (+ (heaps--space heap)
+ (heaps--space heap)))))
;; Check to see if element is in heap
;; there may be a smarter way, but this will work
- (if (heap-member element heap)
+ (if (heaps--member element heap)
nil ;; duplicate caught
- ;; Else
+ ;; Else
;; Put the new element in the next free position in the heap vector
- (heap-aset heap (heap-last heap) element)
+ (setf (heaps--aref heap (heaps--last heap)) element)
;; Increment the element count
- (let ((last (heap-last heap)))
+ (let ((last (heaps--last heap)))
(if (> last 0)
- (heap--bubble-up heap last)))
- (heap-set-last heap (1+ (heap-last heap)))))
+ (heaps--bubble-up heap last))
+ (setf (heaps--last heap) (1+ last)))))
-(defun heap-deletemin (heap)
+(defun heaps-deletemin (heap)
"Delete and return the minimum element from the HEAP."
- (if (heap-empty heap)
+ (if (heaps-empty-p heap)
nil
- (heap-set-last heap (1- (heap-last heap)))
- (let* ((minelem (heap-aref heap 0))
- (lastelem (heap-aref heap (heap-last heap))))
- (heap-aset heap 0 lastelem)
- (heap-bubble-down heap 0)
+ (setf (heaps--last heap) (1- (heaps--last heap)))
+ (let* ((minelem (heaps--aref heap 0))
+ (lastelem (heaps--aref heap (heaps--last heap))))
+ (setf (heaps--aref heap 0) lastelem)
+ (heaps--bubble-down heap 0)
minelem)))
-(defsubst heap-index-of-min (heap i j)
+(defsubst heaps--index-of-min (heap i j)
"Given a HEAP and two indices I and J, return the index that points
to the lesser of the corresponding elements."
- (if (> 0 (heap-compare heap (heap-aref heap i) (heap-aref heap j))) i j))
+ (if (> 0 (heaps--compare heap (heaps--aref heap i) (heaps--aref heap j))) i
j))
-(defun heap-bubble-down (heap index)
- "Helper function for heap-deletemin."
+(defun heaps--bubble-down (heap index)
+ "Helper function for heaps-deletemin."
(let* ((leftindex (+ index index 1))
(rightindex (+ leftindex 1))
(minchild))
- (if (>= leftindex (heap-last heap)) ; if no left child
+ (if (>= leftindex (heaps--last heap)) ; if no left child
()
- (if (>= rightindex (heap-last heap)) ; if no right child
+ (if (>= rightindex (heaps--last heap)) ; if no right child
(setq minchild leftindex)
- (setq minchild (heap-index-of-min heap leftindex rightindex)))
- (if (not (= (heap-index-of-min heap index minchild) minchild))
+ (setq minchild (heaps--index-of-min heap leftindex rightindex)))
+ (if (not (= (heaps--index-of-min heap index minchild) minchild))
()
- (heap-swap heap index minchild)
- (heap-bubble-down heap minchild)))))
+ (heaps--swap heap index minchild)
+ (heaps--bubble-down heap minchild)))))
-(defun heap-member (element heap)
+(defun heaps--member (element heap)
"Return t if element is in heap."
;; assume that heap is a heap
;; brute force (should be faster with a binary search, as in a HEAP!
- (if (heap-empty heap) nil
- (let ((heap-compare-fun (aref heap 0))
+ (if (heaps-empty-p heap) nil
+ (let ((compare-fun (heaps--compare-function heap))
(i 0) (result nil)
- (last (heap-last heap)))
+ (last (heaps--last heap)))
(while (and (< i last) (not result))
- (if (= 0 (funcall heap-compare-fun element (heap-aref heap i)))
+ (if (= 0 (funcall compare-fun element (heaps--aref heap i)))
(setq result t))
(setq i (+ 1 i)))
result)))
-;; (heap-member '(2 . 2) a)
+;; (heaps--member '(2 . 2) a)
;; Some test code:
;;
-;; (setq dismal-invalid-heapA (heap-create 'dismal-address-compare))
+;; (setq dismal-invalid-heapA (heaps-create #'dismal-address-compare))
;; (setq dismal-invalid-heap dismal-invalid-heapA)
;;
-;; (heap-empty dismal-invalid-heap)
-;; (heap-insert dismal-invalid-heap (cons 2 0))
-;; (heap-insert dismal-invalid-heap (cons 3 0))
-;; (heap-insert dismal-invalid-heap (cons 4 0))
-;; (heap-insert dismal-invalid-heap (cons 4 0))
-;; (heap-insert dismal-invalid-heap (cons 3 0))
-;; (heap-insert dismal-invalid-heap (cons 2 0))
+;; (heaps-empty-p dismal-invalid-heap)
+;; (heaps-insert dismal-invalid-heap (cons 2 0))
+;; (heaps-insert dismal-invalid-heap (cons 3 0))
+;; (heaps-insert dismal-invalid-heap (cons 4 0))
+;; (heaps-insert dismal-invalid-heap (cons 4 0))
+;; (heaps-insert dismal-invalid-heap (cons 3 0))
+;; (heaps-insert dismal-invalid-heap (cons 2 0))
;;
-;; (setq addr (heap-deletemin dismal-invalid-heap))
+;; (setq addr (heaps-deletemin dismal-invalid-heap))
(provide 'heaps)
;;; heaps.el ends here
diff --git a/keystroke.el b/keystroke.el
index 2633ea4..ff3a8f0 100644
--- a/keystroke.el
+++ b/keystroke.el
@@ -1,6 +1,6 @@
-;;; keystroke.el --- Keystroke-level model to be incorporated into Dismal
+;;; keystroke.el --- Keystroke-level model to be incorporated into Dismal -*-
lexical-binding: t; -*-
-;; Copyright (C) 1994, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
;; Author: Sarah Nichols, University of Nottingham
@@ -69,9 +69,9 @@
;;;
;;; I. command-time: Time to enter a command
;;;
-;;; Takes COMMAND (a string) as arguement, automatically calculates
-;;; mental operators by looking for hyphens, and includes average typing
-;;; speed from wpm to return time to execute command in seconds.
+;; Takes COMMAND (a string) as arguement, automatically calculates
+;; mental operators by looking for hyphens, and includes average typing
+;; speed from wpm to return time to execute command in seconds.
(add-hook 'dis-user-cell-functions #'klm-time)
diff --git a/log.el b/log.el
index 31cc917..e0bfaaa 100644
--- a/log.el
+++ b/log.el
@@ -1,6 +1,6 @@
;;; log.el --- Command usage log for Michael Hucka -*- lexical-binding:t -*-
-;; Copyright (C) 1991, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
;; Author: Erik Altmann, Frank Ritter & Nick Jackson
;; Created-On: Sat Nov 14 19:24:27 1992
@@ -169,12 +169,12 @@
;;;###autoload
(define-minor-mode log-session-mode
"Minor mode to log a session (keystrokes, timestamps etc)."
- :global t
+ :global t :group 'dismal
(if log-session-mode
(add-hook 'post-command-hook #'log-stamp-date)
(remove-hook 'post-command-hook #'log-stamp-date)))
-(define-obsolete-function-alias 'log-initialize 'log-session-mode "Dismal-1.6")
+(define-obsolete-function-alias 'log-initialize #'log-session-mode
"Dismal-1.6")
;; 11-17-94 -fer
(defun log-quit ()
@@ -421,7 +421,7 @@ already wrapped. PREFIX is an optional string, usually the
command prefix."
(set-buffer-modified-p t)) ; temp output doesn't modify a buffer
(log-temp-buffer buf))
-(defalias 'log-temp-buffer-show-function 'log-temp-buffer-show-hook)
+(defalias 'log-temp-buffer-show-function #'log-temp-buffer-show-hook)
;; automatically save log buffer and files visited by process buffers
;; when exiting.
diff --git a/make-km-aliases.el b/make-km-aliases.el
index ea2b872..8d31f70 100644
--- a/make-km-aliases.el
+++ b/make-km-aliases.el
@@ -1,4 +1,4 @@
-;;; make-km-aliases.el --- A simple way to create Dismal aliases
+;;; make-km-aliases.el --- A simple way to create Dismal aliases -*-
lexical-binding: t; -*-
;; Copyright (C) 1994-2021 Free Software Foundation, Inc.
@@ -10,6 +10,12 @@
(require 'simple-menu)
+;; FIXME: There's circular dependency between `dismal.el' and
+;; `make-km-aliases.el'. We should fix it with a new `dismal-lib.el',
+;; but in the mean time, just silence the warnings.
+(defvar dismal-current-col)
+(defvar dismal-current-row)
+
(defvar dismal-old-aliases nil "*Old commands that you have passed in.")
(make-variable-buffer-local 'dismal-old-aliases)
@@ -32,7 +38,7 @@
(defun dismal-display-dup-aliases ()
"Print out the duplicated aliases so far for make-aliases."
(interactive)
- (let ((old-buffer (current-buffer))
+ (let (;; (old-buffer (current-buffer))
(dups dismal-dup-aliases))
(pop-to-buffer sm-help-buffer)
(erase-buffer)
@@ -47,7 +53,7 @@
;;; I. dismal-make-alias
;;;
-(add-hook 'dis-user-cell-functions 'dismal-make-alias)
+(add-hook 'dis-user-cell-functions #'dismal-make-alias)
(defun dismal-make-alias (old)
"Make an alias given an OLD command.
diff --git a/rmatrix.el b/rmatrix.el
index 58d8d83..496edd1 100644
--- a/rmatrix.el
+++ b/rmatrix.el
@@ -1,6 +1,6 @@
-;;; rmatrix.el --- Matrices implemented as vector of vectors, gives rows
priority
+;;; rmatrix.el --- Matrices implemented as vector of vectors, gives rows
priority -*- lexical-binding: t; -*-
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
;; Author: David Fox, fox@cs.nyu.edu
;; Created-On: Mon Jan 6 14:17:56 1992
diff --git a/semi-coder.el b/semi-coder.el
index 02d4802..47a26cf 100644
--- a/semi-coder.el
+++ b/semi-coder.el
@@ -1,4 +1,4 @@
-;;; semi-coder.el --- Let users insert codes from model into Soar/PA sheets.
+;;; semi-coder.el --- Let users insert codes from model into Soar/PA sheets.
-*- lexical-binding: t; -*-
;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
@@ -116,6 +116,8 @@
(defconst dis-init-op-codes-prompt "Attempt to load codes from DSI or TAQL: ")
+(declare-function ilisp-send "ext:ilisp")
+
(defun dis-initialize-operator-codes ()
"Initialize the dismal operator codes."
;; used to require either SX+ latest pscm-stats, or taql and taql-stats
@@ -124,7 +126,7 @@
(let ((completion-ignore-case t))
;; look in process, or query user for a file
(cond
- ((comint-check-proc "*soar*")
+ ((and (fboundp 'comint-check-proc) (comint-check-proc "*soar*"))
(let ((operator-codes
(car (read-from-string
(downcase
diff --git a/simple-menu.el b/simple-menu.el
index f005522..b2a760d 100644
--- a/simple-menu.el
+++ b/simple-menu.el
@@ -1,6 +1,6 @@
;;; simple-menu.el --- Command-line menus made declaratively -*-
lexical-binding:t -*-
-;; Copyright (C) 1991, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2021 Free Software Foundation, Inc.
;; Author: Frank Ritter & Roberto Ong
;; Created-On: Mon Oct 28 12:28:03 1991
@@ -147,9 +147,9 @@
;;*created this function to quit simple-menu
;; allows a cleaner quit with C-g, 19-May-97 -FER
-(defun sm-quit ()
+(defun sm-quit (&optional command)
"Quit simple-menu to abort, or after a command has been evaluated."
- (if (boundp 'command)
+ (if command
(sm-note-function-key command sm--current-key-map)
(beep)
(message "Quiting simple-menu"))
@@ -305,7 +305,7 @@ TO and FROM are ints, FUN is a symbol."
(suppress-keymap map)
(let ((set-key (lambda (k)
(define-key map (char-to-string k)
- 'exit-minibuffer))))
+ #'exit-minibuffer))))
(sm-for ?a ?z set-key)
(sm-for ?A ?Z set-key)
(sm-for ?0 ?9 set-key)
@@ -320,9 +320,9 @@ TO and FROM are ints, FUN is a symbol."
(funcall set-key ?\t) ; should accept default
;; modified in 1.4 to be ignored, b/c it is messy to use in general
;; (funcall set-key ?\e) ; should abort
- (define-key map "?" 'sm-pop-up-help)
- (define-key map " " 'sm-pop-up-help)
- (define-key map "\C-h" 'sm-pop-up-help))
+ (define-key map "?" #'sm-pop-up-help)
+ (define-key map " " #'sm-pop-up-help)
+ (define-key map "\C-h" #'sm-pop-up-help))
map))
;; Set letters and digits to return from minibuffer
@@ -441,17 +441,17 @@ TO and FROM are ints, FUN is a symbol."
;; (full-prompt (get amenu 'full-prompt))
(prompt))
(setq prompt
- (cond ;; it is something to be eval
- ( (listp raw-prompt)
- (eval raw-prompt))
- ;; it is a function
- ( (and (symbolp raw-prompt) (fboundp raw-prompt))
+ (cond ;; it is a function
+ ( (functionp raw-prompt)
(funcall raw-prompt))
;; it is a string
( (stringp raw-prompt)
(if (not (string= raw-prompt ""))
(concat raw-prompt ": ")
raw-prompt))
+ ;; it is something to be eval
+ ( (listp raw-prompt)
+ (eval raw-prompt t))
;; it is an invalid prompt
(t (sm-error (format "%s contains an invalid prompt."
amenu)))))
(mapc (lambda (x) (setq prompt (concat prompt x " ")))
@@ -530,7 +530,7 @@ TO and FROM are ints, FUN is a symbol."
(fboundp command))
(call-interactively command)
(setq sm-run-menu-flag nil)
- ;; (sm-quit)
+ ;; (sm-quit command)
)
;;*removing this function call because key bindings
;;*could be easily seen in the help screen
@@ -538,8 +538,8 @@ TO and FROM are ints, FUN is a symbol."
;; it is something to eval
( (listp command)
(setq sm-run-menu-flag nil)
- (eval command)
- ;; (sm-quit)
+ (eval command t)
+ ;; (sm-quit command)
)
;; something to be returned
( (or (stringp command) (numberp command))
diff --git a/vectors.el b/vectors.el
index e85b0a9..addeab9 100644
--- a/vectors.el
+++ b/vectors.el
@@ -1,6 +1,6 @@
-;;; vectors.el --- Vectors as arrays that grow automatically
+;;; vectors.el --- Vectors as arrays that grow automatically -*-
lexical-binding: t; -*-
-;; Copyright (C) 1992, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2021 Free Software Foundation, Inc.
;; Author: David Fox, fox@cs.nyu.edu
;; Created-On: Mon Jan 6 14:19:40 1992
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/dismal f029f60: Use lexical-binding everywhere, and fix warnings,
Stefan Monnier <=