branch: externals/dismal commit 670c0001026ff437d14545aeed3ef5745f0a53d2 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Fix a few "free vars" warnings * semi-coder.el (dis-init-op-codes-prompt): Uncomment `defconst` since the var is used in `dis-initialize-operator-codes`. * make-km-aliases.el: Require `simple-menu` to silence some free vars warnings. * dismal-model-extensions.el (dis-model-matcher): Comment out, unused and broken (relies on undefined `string-match-item`). * dismal-metacolumn.el: Require `dismal` to silence some free vars warnings. (dis-insert-z-box, dis-align-metacolumns): Let-bind vars before setting them. * dismal-menu3.el: Move `(require 'make-km-aliases)` here... * dismal.el: .. instead of here. --- dismal-menu3.el | 4 +- dismal-metacolumn.el | 177 +++++++++++++++++++++++---------------------- dismal-model-extensions.el | 36 ++++----- dismal.el | 5 +- make-km-aliases.el | 4 +- semi-coder.el | 4 +- 6 files changed, 117 insertions(+), 113 deletions(-) diff --git a/dismal-menu3.el b/dismal-menu3.el index cddd9c9..7de6c4a 100644 --- a/dismal-menu3.el +++ b/dismal-menu3.el @@ -1,6 +1,6 @@ ;;; dismal-menu3.el --- Menu system for using with Dismal spreadsheet -;; Copyright (C) 1991, 2013-2018 Free Software Foundation, Inc. +;; Copyright (C) 2013-2021 Free Software Foundation, Inc. ;; Author: Nigel Jenkins, n...@cs.nott.ac.uk ;; lpyj...@psyc.nott.ac.uk @@ -35,6 +35,8 @@ ;;; Code: +(require 'make-km-aliases) + (defvar dismal-menu-map (make-sparse-keymap)) (define-key dismal-menu-map [model] diff --git a/dismal-metacolumn.el b/dismal-metacolumn.el index c7e26bf..cae31c3 100644 --- a/dismal-metacolumn.el +++ b/dismal-metacolumn.el @@ -1,6 +1,6 @@ ;;; dismal-metacolumn.el --- Implement metacolumn manipulations for dismal -;; Copyright (C) 1992, 2013 Free Software Foundation, Inc. +;; Copyright (C) 1992-2021 Free Software Foundation, Inc. ;; Author: Frank E. Ritter, rit...@cs.cmu.edu ;; Created-On: Mon Jun 1 13:05:14 1992 @@ -23,6 +23,7 @@ ;;; Code: (require 'dismal-data-structures) +(require 'dismal) ;;;; I. dis-set-metacolumn @@ -76,25 +77,25 @@ at ROW (default, current-row)." "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 sides of the middle-col." - (interactive "P") - (dismal-metacolumn-guards) - (setq r1r dismal-current-row) - (setq r1c dismal-current-col) - (setq r2r (dismal-mark-row)) - (setq r2c (dismal-mark-col)) - (let* ((arg (or initial-arg (abs (- r1r r2r)))) - (dismal-interactive-p nil)) - (if (not (or (and (<= r1c dis-middle-col) (> r2c dis-middle-col)) - (and (<= r2c dis-middle-col) (> r1c dis-middle-col)))) - (error - "Point and mark must be on opposite sides of dis-middle-col, col %s" - dis-middle-col)) - (message "Inserting Z box of %s cells at rows %s and %s..." arg r1r r2r) - ;; Chose the row to go first - (dismal-save-excursion - (dismal-insert-metacolumn-cells arg r1c r1r) - (dismal-insert-metacolumn-cells arg r2c r2r) - (dismal-redraw-range (min r1r r2r) (max r1r r2r))))) + (interactive "P") + (dismal-metacolumn-guards) + (let* ((r1r dismal-current-row) + (r1c dismal-current-col) + (r2r (dismal-mark-row)) + (r2c (dismal-mark-col)) + (arg (or initial-arg (abs (- r1r r2r)))) + (dismal-interactive-p nil)) + (if (not (or (and (<= r1c dis-middle-col) (> r2c dis-middle-col)) + (and (<= r2c dis-middle-col) (> r1c dis-middle-col)))) + (error + "Point and mark must be on opposite sides of dis-middle-col, col %s" + dis-middle-col)) + (message "Inserting Z box of %s cells at rows %s and %s..." arg r1r r2r) + ;; Chose the row to go first + (dismal-save-excursion + (dismal-insert-metacolumn-cells arg r1c r1r) + (dismal-insert-metacolumn-cells arg r2c r2r) + (dismal-redraw-range (min r1r r2r) (max r1r r2r))))) ;; (dismal-insert-range-cells 11 0 11 dismal-middle-col 1) @@ -107,74 +108,74 @@ sides of the middle-col." (defun dis-align-metacolumns () "Align the metacolumns so that point and mark are on the same line, keeping other parts of the columns still aligned." - (interactive) - (dismal-metacolumn-guards) - (dismal-save-excursion - (setq r1r dismal-current-row) - (setq r1c dismal-current-col) - (setq r2r (dismal-mark-row)) - (setq r2c (dismal-mark-col)) - (let* (first-row first-col-start first-col-end - ;; these are used to do insertion - 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)))) - (error "Point & mark must be across dis-middle-col, col %s (aka #%s)" - (dismal-convert-number-to-colname dis-middle-col) - dis-middle-col)) - (if (= r1r r2r) - nil ;; you are done, jump down to telling - ;; Chose the row to go first, and set the columns up - (cond ((> r1r r2r) ;; point is after mark - (setq first-row r2r) (setq second-row r1r) - (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)) - (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)))) - (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)) - (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))))) - (if dismal-interactive-p - (if (= first-col-start 0) - (message "Aligning row %s (R) to row %s (L)..." second-row first-row) - (message "Aligning row %s (R) to row %s (L)..." first-row second-row))) - ;; Insert some blank cells in front of earlier column - ;; (my-message "inserting %s %s to %s %s N cells %s" - ;; first-row first-col-start first-row first-col-end arg) - (dismal-insert-range-cells first-row first-col-start - first-row first-col-end arg) - ;; Insert some blank cells after the later column - ;; (my-message "inserting %s %s to %s %s N cells %s" - ;; (1+ second-row) second-col-start (1+ second-row) second-col-end arg) - ;; this appear to be taken care of in insert-range-cells, 13-Jan-94 -FER - ;; (dismal-insert-range-cells (1+ second-row) second-col-start - ;; (1+ second-row) second-col-end arg) - ;; Delete blank lines in region - (dis-delete-blank-rows (- first-row arg) (+ second-row arg)) - (dismal-redraw-range (max 0 (- first-row arg)) (+ second-row arg))) - - ;; this needs to be done, but its a mess to do right - ;; (dismal-change-row-references dismal-current-row arg) - - (and dismal-interactive-p - (progn - (message "Aligning rows %s to row %s...Finished." first-row second-row) - (beep t))) ))) + (interactive) + (dismal-metacolumn-guards) + (dismal-save-excursion + (let* ((r1r dismal-current-row) + (r1c dismal-current-col) + (r2r (dismal-mark-row)) + (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 + (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)))) + (error "Point & mark must be across dis-middle-col, col %s (aka #%s)" + (dismal-convert-number-to-colname dis-middle-col) + dis-middle-col)) + (if (= r1r r2r) + nil ;; you are done, jump down to telling + ;; Chose the row to go first, and set the columns up + (cond ((> r1r r2r) ;; point is after mark + (setq first-row r2r) (setq second-row r1r) + (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)) + (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)))) + (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)) + (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))))) + (if dismal-interactive-p + (if (= first-col-start 0) + (message "Aligning row %s (R) to row %s (L)..." second-row first-row) + (message "Aligning row %s (R) to row %s (L)..." first-row second-row))) + ;; Insert some blank cells in front of earlier column + ;; (my-message "inserting %s %s to %s %s N cells %s" + ;; first-row first-col-start first-row first-col-end arg) + (dismal-insert-range-cells first-row first-col-start + first-row first-col-end arg) + ;; Insert some blank cells after the later column + ;; (my-message "inserting %s %s to %s %s N cells %s" + ;; (1+ second-row) second-col-start (1+ second-row) second-col-end arg) + ;; this appear to be taken care of in insert-range-cells, 13-Jan-94 -FER + ;; (dismal-insert-range-cells (1+ second-row) second-col-start + ;; (1+ second-row) second-col-end arg) + ;; Delete blank lines in region + (dis-delete-blank-rows (- first-row arg) (+ second-row arg)) + (dismal-redraw-range (max 0 (- first-row arg)) (+ second-row arg))) + + ;; this needs to be done, but its a mess to do right + ;; (dismal-change-row-references dismal-current-row arg) + + (and dismal-interactive-p + (progn + (message "Aligning rows %s to row %s...Finished." first-row second-row) + (beep t))) ))) ;;;; V. Utilities diff --git a/dismal-model-extensions.el b/dismal-model-extensions.el index ed3cadd..7504c61 100644 --- a/dismal-model-extensions.el +++ b/dismal-model-extensions.el @@ -1,6 +1,6 @@ ;;; dismal-model-extensions.el --- Specialized extensions to dismal -;; Copyright (C) 1992, 2013 Free Software Foundation, Inc. +;; Copyright (C) 1992-2021 Free Software Foundation, Inc. ;; Author: Frank E. Ritter, rit...@cs.cmu.edu ;; Created-On: Wed May 20 15:50:22 1992 @@ -52,23 +52,23 @@ that is in order." (interactive "P") (model-matcher range-list "O: ")) -(defun dis-model-matcher (range-list string-test) - (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 (- col 2))) ) - ;;(my-message "Row: %s dc is %s, match is %s, total %s" row dc mdc total) - (if (and dc (stringp dc) (or (not string-match-item) - (string-match string-match-item dc))) - (progn - (setq total (1+ total)) - (setq matches - (if mdc - (1+ matches) - matches))))))) - range-list 0) - (dis-div (float matches) (float total)) )) +;; (defun dis-model-matcher (range-list string-test) +;; (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 (- col 2))) ) +;; ;;(my-message "Row: %s dc is %s, match is %s, total %s" row dc mdc total) +;; (if (and dc (stringp dc) (or (not string-match-item) +;; (string-match string-match-item dc))) +;; (progn +;; (setq total (1+ total)) +;; (setq matches +;; (if mdc +;; (1+ matches) +;; matches))))))) +;; range-list 0) +;; (dis-div (float matches) (float total)) )) ;;;; II. dis-model-rate diff --git a/dismal.el b/dismal.el index 6002d0b..0d2fd00 100644 --- a/dismal.el +++ b/dismal.el @@ -1,12 +1,12 @@ ;;; dismal.el --- Dis Mode Ain't Lotus: Spreadsheet program Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 1993-2021 Free Software Foundation, Inc. +;; Copyright (C) 1993-2021 Free Software Foundation, Inc. ;; Author: David Fox, f...@cs.nyu.edu ;; Frank E. Ritter, rit...@cs.cmu.edu ;; Maintainer: UnMaintainer <emacs-de...@gnu.org> ;; Created-On: 31 Oct 1991. -;; Version: 1.5.1 +;; Version: 1.5.2 ;; Package-Requires: ((cl-lib "0")) ;; This is free software: you can redistribute it and/or modify @@ -493,7 +493,6 @@ with something in colA-1. Only counts stuff that is in order." t) ;; cheap enough, so always include (require 'keystroke) -(require 'make-km-aliases) ;;;; vii. Former ritter-math diff --git a/make-km-aliases.el b/make-km-aliases.el index 0df64f9..ea2b872 100644 --- a/make-km-aliases.el +++ b/make-km-aliases.el @@ -1,6 +1,6 @@ ;;; make-km-aliases.el --- A simple way to create Dismal aliases -;; Copyright (C) 1994, 2013 Free Software Foundation, Inc. +;; Copyright (C) 1994-2021 Free Software Foundation, Inc. ;; Author: Frank Ritter & Nichols @@ -8,6 +8,8 @@ ;;; Code: +(require 'simple-menu) + (defvar dismal-old-aliases nil "*Old commands that you have passed in.") (make-variable-buffer-local 'dismal-old-aliases) diff --git a/semi-coder.el b/semi-coder.el index cb0337b..02d4802 100644 --- a/semi-coder.el +++ b/semi-coder.el @@ -1,6 +1,6 @@ ;;; semi-coder.el --- Let users insert codes from model into Soar/PA sheets. -;; Copyright (C) 1992-2019 Free Software Foundation, Inc. +;; Copyright (C) 1992-2021 Free Software Foundation, Inc. ;; Author: Frank Ritter ;; Created-On: Sun Jul 19 02:04:03 1992 @@ -114,7 +114,7 @@ ;;;; IV. Utilities -;; (defconst dis-init-op-codes-prompt "Attempt to load codes from DSI or TAQL: ") +(defconst dis-init-op-codes-prompt "Attempt to load codes from DSI or TAQL: ") (defun dis-initialize-operator-codes () "Initialize the dismal operator codes."