If CADR of a TEDIT.ABBREVS entry is LITATOM that can CHARCODE.DECODE (i.e., it's on CHARACTERNAMES), use it.
Clear the TEdit prompt window if \TEDIT.ABBREV.EXPAND finds an expansion in TEDIT.ABBREVS.
"=" is duplicated as an expansion KEY, so modified TEDIT.ABBREVS entry:
("=" "357,121")
to
("lra" "357,121" ; U+21C6 Leftwards Arrow Over Rightwards Arrow ("lra" is "left-right-arrow")
)
because "=" is also the KEY in entry:
("=" NONBREAKING-HYPHEN)
which was never seen as a possibility (the above was earlier in the ALIST).
(This change exposed the issue with LITATOM as CADR of entry.)
Cleaned up some comments, typos. Added a few more TEDIT.ABBREVS entries.
This commit is contained in:
parent
f0067ffa1d
commit
08a1d79265
@ -1,14 +1,13 @@
|
||||
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
|
||||
|
||||
(FILECREATED " 5-Sep-2025 18:50:19"
|
||||
{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-ABBREV.;29 17935
|
||||
(FILECREATED " 1-Dec-2025 20:26:49" {DSK}<home>matt>Interlisp>medley>library>tedit>TEDIT-ABBREV.;4 20152
|
||||
|
||||
:EDIT-BY rmk
|
||||
:EDIT-BY "mth"
|
||||
|
||||
:CHANGES-TO (VARS TEDIT-ABBREVCOMS)
|
||||
:CHANGES-TO (FNS \TEDIT.ABBREV.EXPAND \TEDIT.ABBREV.PARSE \TEDIT.EXPAND.DATE \TEDIT.TRY.ABBREV)
|
||||
|
||||
:PREVIOUS-DATE " 5-Sep-2025 12:24:55"
|
||||
{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-ABBREV.;28)
|
||||
:PREVIOUS-DATE " 1-Dec-2025 12:27:11"
|
||||
{DSK}<home>matt>Interlisp>medley>library>tedit>TEDIT-ABBREV.;3)
|
||||
|
||||
|
||||
(PRETTYCOMPRINT TEDIT-ABBREVCOMS)
|
||||
@ -47,7 +46,9 @@
|
||||
("+" "0,261" PlusMinus)
|
||||
("x" "0,264" Times)
|
||||
("/" "0,270" Divide)
|
||||
("=" "357,121")
|
||||
("lra" "357,121" (* ;
|
||||
"U+21C6 Leftwards Arrow Over Rightwards Arrow (%"lra%" is %"left-right-arrow%")")
|
||||
)
|
||||
("p" "0,266" Paragraph)
|
||||
("r" "0,322" Register)
|
||||
("t" "0,324" Trademark)
|
||||
@ -68,15 +69,21 @@
|
||||
("exist" "357,264")
|
||||
("def" "357,162")
|
||||
("compose" "357,147")
|
||||
("!" "0,241" (* ; "Inverted !"))
|
||||
("?" "0,277" (* ; "Inverted ?"))
|
||||
("u" "0,265" MicroSign)
|
||||
("<<" "0,253" (* ; "Left double guillemet"))
|
||||
(">>" "0,273" (* ; "Right double guillemet"))
|
||||
("DATE" \TEDIT.EXPAND.DATE)
|
||||
(">>DATE<<" \TEDIT.EXPAND.DATE])
|
||||
(DEFINEQ
|
||||
|
||||
(\TEDIT.ABBREV.EXPAND
|
||||
[LAMBDA (TSTREAM TEXTOBJ SEL) (* ; "Edited 20-Apr-2025 23:30 by rmk")
|
||||
[LAMBDA (TSTREAM TEXTOBJ SEL) (* ; "Edited 1-Dec-2025 20:14 by mth")
|
||||
(* ; "Edited 20-Apr-2025 23:30 by rmk")
|
||||
(* ; "Edited 20-Mar-2025 21:52 by rmk")
|
||||
(* ; "Edited 30-May-91 19:27 by jds")
|
||||
(* ; "Expand an abbvreviation")
|
||||
(* ; "Expand an abbreviation")
|
||||
(LET ((CANDIDATES (\TEDIT.ABBREV.PARSE TSTREAM SEL))
|
||||
CAND EXPANSION)
|
||||
|
||||
@ -96,7 +103,12 @@
|
||||
(L-CASE (CAR C))
|
||||
TSTREAM]
|
||||
(if EXPANSION
|
||||
then (\TEDIT.UPDATE.SEL SEL (CADR CAND)
|
||||
then
|
||||
(* ;;
|
||||
"First, remove any old messages, e.g., previous %"No abbreviation to expand%" errors")
|
||||
|
||||
(TEDIT.PROMPTPRINT TSTREAM "" T)
|
||||
(\TEDIT.UPDATE.SEL SEL (CADR CAND)
|
||||
(CADDR CAND)
|
||||
'RIGHT
|
||||
'NORMAL) (* ; "Set the target")
|
||||
@ -107,7 +119,8 @@
|
||||
else (TEDIT.PROMPTPRINT TSTREAM "No abbreviation to expand" T])
|
||||
|
||||
(\TEDIT.ABBREV.PARSE
|
||||
[LAMBDA (TSTREAM SEL) (* ; "Edited 11-Aug-2025 14:40 by rmk")
|
||||
[LAMBDA (TSTREAM SEL) (* ; "Edited 1-Dec-2025 20:18 by mth")
|
||||
(* ; "Edited 11-Aug-2025 14:40 by rmk")
|
||||
(* ; "Edited 7-Aug-2025 12:50 by rmk")
|
||||
(* ; "Edited 24-Apr-2025 23:45 by rmk")
|
||||
(* ; "Edited 28-Mar-2025 10:11 by rmk")
|
||||
@ -117,7 +130,7 @@
|
||||
(* ;; "This produces candidate abbreviation-strings by parsing the characters around the point. Each candidate is returned as a list (KEY STARTCH# LEN).")
|
||||
|
||||
(* ;;
|
||||
"It first backs up over any spaces to find the anchor position. The candidates then include")
|
||||
"It first backs up over any spaces to find the anchor position. The candidates then include")
|
||||
|
||||
(* ;; " The immediately preceding singleton character, if a point selection")
|
||||
|
||||
@ -125,7 +138,7 @@
|
||||
|
||||
(* ;; " The word that contains the caret (backwards and forwards)")
|
||||
|
||||
(* ;; " If the character before a candidate C is a comma, then the word before W before the comma (without or without \) is extracted, and W,C is is added to the list (a possible charname).")
|
||||
(* ;; "If the character before a candidate C is a comma, then the word before W before the comma (without or without \) is extracted, and W,C is is added to the list (a possible charname).")
|
||||
|
||||
(* ;; "If the character before a candidate C is \, the \ is included in the replacement span, and \C is also added to the list (Tex style)")
|
||||
|
||||
@ -173,7 +186,10 @@
|
||||
FIRST# LEN))) (* ; "Extend if a ,")
|
||||
[for C KEY END in CANDIDATES
|
||||
do
|
||||
(* ;; "Comma for MCCS character names, - and / - for internal punctuation (3/4 EMDASH). Adjacent character must be text")
|
||||
(* ;;
|
||||
"Comma for MCCS character names, - and / - for internal punctuation (3/4 EMDASH). ")
|
||||
|
||||
(* ;; "Adjacent character must be text")
|
||||
|
||||
(if [AND (MEMB (\TEDIT.NTHCHARCODE TSTREAM (SUB1 (CADR C)))
|
||||
(CHARCODE (%, / -)))
|
||||
@ -234,14 +250,23 @@
|
||||
" " DAY ", " YEAR])
|
||||
|
||||
(\TEDIT.TRY.ABBREV
|
||||
[LAMBDA (KEY TSTREAM) (* ; "Edited 5-Sep-2025 12:24 by rmk")
|
||||
[LAMBDA (KEY TSTREAM) (* ; "Edited 1-Dec-2025 20:26 by mth")
|
||||
(* ; "Edited 5-Sep-2025 12:24 by rmk")
|
||||
(* ; "Edited 20-Mar-2025 21:52 by rmk")
|
||||
(* ; "Edited 6-Aug-2020 14:41 by rmk:")
|
||||
(* jds "11-Jul-85 12:46")
|
||||
(* ; "jds %"11-Jul-85 12:46%"")
|
||||
|
||||
(* ;; "Decode the expansion. A string may be a character name, otherwise itself. A litatom is a function to be applied, anything else is evaled. ")
|
||||
(* ;; "Decode the expansion. ")
|
||||
|
||||
(LET [(ABBREV (CDR (SASSOC KEY TEDIT.ABBREVS]
|
||||
(* ;; "A string may be a character name, otherwise itself. ")
|
||||
|
||||
(* ;;
|
||||
"A litatom may be a character name, otherwise, it is a function (if has GETD) to be applied.")
|
||||
|
||||
(* ;; "Anything else is EVALed. ")
|
||||
|
||||
(LET ((ABBREV (CDR (SASSOC KEY TEDIT.ABBREVS)))
|
||||
CH)
|
||||
(CL:WHEN (LISTP ABBREV) (* ; "Originally stored in the CDR")
|
||||
(SETQ ABBREV (CAR ABBREV)))
|
||||
(if (NULL ABBREV)
|
||||
@ -251,21 +276,30 @@
|
||||
then
|
||||
(* ;; "Could be a character code")
|
||||
|
||||
(LET ((CH (CHARCODE.DECODE ABBREV T)))
|
||||
(CL:IF CH
|
||||
(CHARACTER CH)
|
||||
ABBREV))
|
||||
(SETQ CH (CHARCODE.DECODE ABBREV T))
|
||||
(CL:IF CH
|
||||
(CHARACTER CH)
|
||||
ABBREV)
|
||||
elseif (SMALLP ABBREV)
|
||||
then
|
||||
(* ;; "Treat a number as a character code.")
|
||||
|
||||
(CHARACTER ABBREV)
|
||||
elseif (AND (LITATOM ABBREV)
|
||||
(SETQ CH (CHARCODE.DECODE ABBREV T)))
|
||||
then
|
||||
(* ;; "A LITATOM character %"code%" (i.e., on CHARACTERNAMES)")
|
||||
|
||||
(CHARACTER CH)
|
||||
elseif (AND (LITATOM ABBREV)
|
||||
(GETD ABBREV))
|
||||
then (* ; " A function to be applied.")
|
||||
(APPLY* ABBREV TSTREAM KEY)
|
||||
elseif (LISTP ABBREV)
|
||||
then (* ; "Form in the CADR, now")
|
||||
|
||||
(* ;; "Should this have checked (GETD (CAR ABBREV))?")
|
||||
|
||||
(EVAL ABBREV)
|
||||
elseif (AND (SETQ ABBREV (CDR (SASSOC KEY TEDIT.ABBREVS)))
|
||||
(LITATOM (CAR ABBREV))
|
||||
@ -312,7 +346,9 @@
|
||||
("+" "0,261" PlusMinus)
|
||||
("x" "0,264" Times)
|
||||
("/" "0,270" Divide)
|
||||
("=" "357,121")
|
||||
("lra" "357,121" (* ;
|
||||
"U+21C6 Leftwards Arrow Over Rightwards Arrow (%"lra%" is %"left-right-arrow%")")
|
||||
)
|
||||
("p" "0,266" Paragraph)
|
||||
("r" "0,322" Register)
|
||||
("t" "0,324" Trademark)
|
||||
@ -333,9 +369,14 @@
|
||||
("exist" "357,264")
|
||||
("def" "357,162")
|
||||
("compose" "357,147")
|
||||
("!" "0,241" (* ; "Inverted !"))
|
||||
("?" "0,277" (* ; "Inverted ?"))
|
||||
("u" "0,265" MicroSign)
|
||||
("<<" "0,253" (* ; "Left double guillemet"))
|
||||
(">>" "0,273" (* ; "Right double guillemet"))
|
||||
("DATE" \TEDIT.EXPAND.DATE)
|
||||
(">>DATE<<" \TEDIT.EXPAND.DATE)))
|
||||
(DECLARE%: DONTCOPY
|
||||
(FILEMAP (NIL (3630 16182 (\TEDIT.ABBREV.EXPAND 3640 . 5860) (\TEDIT.ABBREV.PARSE 5862 . 13472) (
|
||||
\TEDIT.EXPAND.DATE 13474 . 14107) (\TEDIT.TRY.ABBREV 14109 . 16180)))))
|
||||
(FILEMAP (NIL (4248 17832 (\TEDIT.ABBREV.EXPAND 4258 . 6793) (\TEDIT.ABBREV.PARSE 6795 . 14564) (
|
||||
\TEDIT.EXPAND.DATE 14566 . 15199) (\TEDIT.TRY.ABBREV 15201 . 17830)))))
|
||||
STOP
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user