diff options
Diffstat (limited to 'lisp/textmodes/artist.el')
-rw-r--r-- | lisp/textmodes/artist.el | 144 |
1 files changed, 74 insertions, 70 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index e6fddd216d7..2cf9ded04bf 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -184,7 +184,6 @@ ;; Variables -(defconst artist-version "1.2.6") (defconst artist-maintainer-address "tab@lysator.liu.se, bug-gnu-emacs@gnu.org") (defvar x-pointer-crosshair) @@ -338,7 +337,8 @@ Example: (defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil) "If in X Windows, use this pointer shape while drawing with the mouse.") -(defvaralias 'artist-text-renderer 'artist-text-renderer-function) +(define-obsolete-variable-alias 'artist-text-renderer + 'artist-text-renderer-function "29.1") (defcustom artist-text-renderer-function 'artist-figlet "Function for doing text rendering." @@ -474,60 +474,57 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.") (defvar artist-arrow-point-1 nil) (defvar artist-arrow-point-2 nil) -(defvar artist-mode-map - (let ((map (make-sparse-keymap))) - (setq artist-mode-map (make-sparse-keymap)) - (define-key map [down-mouse-1] 'artist-down-mouse-1) - (define-key map [S-down-mouse-1] 'artist-down-mouse-1) - (define-key map [down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [S-down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [down-mouse-3] 'artist-down-mouse-3) - (define-key map [S-down-mouse-3] 'artist-down-mouse-3) - (define-key map [C-mouse-4] 'artist-select-prev-op-in-list) - (define-key map [C-mouse-5] 'artist-select-next-op-in-list) - (define-key map "\r" 'artist-key-set-point) ; return - (define-key map [up] 'artist-previous-line) - (define-key map "\C-p" 'artist-previous-line) - (define-key map [down] 'artist-next-line) - (define-key map "\C-n" 'artist-next-line) - (define-key map [left] 'artist-backward-char) - (define-key map "\C-b" 'artist-backward-char) - (define-key map [right] 'artist-forward-char) - (define-key map "\C-f" 'artist-forward-char) - (define-key map "<" 'artist-toggle-first-arrow) - (define-key map ">" 'artist-toggle-second-arrow) - (define-key map "\C-c\C-a\C-e" 'artist-select-erase-char) - (define-key map "\C-c\C-a\C-f" 'artist-select-fill-char) - (define-key map "\C-c\C-a\C-l" 'artist-select-line-char) - (define-key map "\C-c\C-a\C-o" 'artist-select-operation) - (define-key map "\C-c\C-a\C-r" 'artist-toggle-rubber-banding) - (define-key map "\C-c\C-a\C-t" 'artist-toggle-trim-line-endings) - (define-key map "\C-c\C-a\C-s" 'artist-toggle-borderless-shapes) - (define-key map "\C-c\C-c" 'artist-mode-off) - (define-key map "\C-c\C-al" 'artist-select-op-line) - (define-key map "\C-c\C-aL" 'artist-select-op-straight-line) - (define-key map "\C-c\C-ar" 'artist-select-op-rectangle) - (define-key map "\C-c\C-aR" 'artist-select-op-square) - (define-key map "\C-c\C-as" 'artist-select-op-square) - (define-key map "\C-c\C-ap" 'artist-select-op-poly-line) - (define-key map "\C-c\C-aP" 'artist-select-op-straight-poly-line) - (define-key map "\C-c\C-ae" 'artist-select-op-ellipse) - (define-key map "\C-c\C-ac" 'artist-select-op-circle) - (define-key map "\C-c\C-at" 'artist-select-op-text-see-thru) - (define-key map "\C-c\C-aT" 'artist-select-op-text-overwrite) - (define-key map "\C-c\C-aS" 'artist-select-op-spray-can) - (define-key map "\C-c\C-az" 'artist-select-op-spray-set-size) - (define-key map "\C-c\C-a\C-d" 'artist-select-op-erase-char) - (define-key map "\C-c\C-aE" 'artist-select-op-erase-rectangle) - (define-key map "\C-c\C-av" 'artist-select-op-vaporize-line) - (define-key map "\C-c\C-aV" 'artist-select-op-vaporize-lines) - (define-key map "\C-c\C-a\C-k" 'artist-select-op-cut-rectangle) - (define-key map "\C-c\C-a\M-w" 'artist-select-op-copy-rectangle) - (define-key map "\C-c\C-a\C-y" 'artist-select-op-paste) - (define-key map "\C-c\C-af" 'artist-select-op-flood-fill) - (define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report) - map) - "Keymap for `artist-mode'.") +(defvar-keymap artist-mode-map + :doc "Keymap for `artist-mode'." + "<down-mouse-1>" #'artist-down-mouse-1 + "S-<down-mouse-1>" #'artist-down-mouse-1 + "<down-mouse-2>" #'artist-mouse-choose-operation + "S-<down-mouse-2>" #'artist-mouse-choose-operation + "<down-mouse-3>" #'artist-down-mouse-3 + "S-<down-mouse-3>" #'artist-down-mouse-3 + "C-<mouse-4>" #'artist-select-prev-op-in-list + "C-<mouse-5>" #'artist-select-next-op-in-list + "RET" #'artist-key-set-point ; return + "<up>" #'artist-previous-line + "C-p" #'artist-previous-line + "<down>" #'artist-next-line + "C-n" #'artist-next-line + "<left>" #'artist-backward-char + "C-b" #'artist-backward-char + "<right>" #'artist-forward-char + "C-f" #'artist-forward-char + "<" #'artist-toggle-first-arrow + ">" #'artist-toggle-second-arrow + "C-c C-a C-e" #'artist-select-erase-char + "C-c C-a C-f" #'artist-select-fill-char + "C-c C-a C-l" #'artist-select-line-char + "C-c C-a C-o" #'artist-select-operation + "C-c C-a C-r" #'artist-toggle-rubber-banding + "C-c C-a C-t" #'artist-toggle-trim-line-endings + "C-c C-a C-s" #'artist-toggle-borderless-shapes + "C-c C-c" #'artist-mode-off + "C-c C-a l" #'artist-select-op-line + "C-c C-a L" #'artist-select-op-straight-line + "C-c C-a r" #'artist-select-op-rectangle + "C-c C-a R" #'artist-select-op-square + "C-c C-a s" #'artist-select-op-square + "C-c C-a p" #'artist-select-op-poly-line + "C-c C-a P" #'artist-select-op-straight-poly-line + "C-c C-a e" #'artist-select-op-ellipse + "C-c C-a c" #'artist-select-op-circle + "C-c C-a t" #'artist-select-op-text-see-thru + "C-c C-a T" #'artist-select-op-text-overwrite + "C-c C-a S" #'artist-select-op-spray-can + "C-c C-a z" #'artist-select-op-spray-set-size + "C-c C-a C-d" #'artist-select-op-erase-char + "C-c C-a E" #'artist-select-op-erase-rectangle + "C-c C-a v" #'artist-select-op-vaporize-line + "C-c C-a V" #'artist-select-op-vaporize-lines + "C-c C-a C-k" #'artist-select-op-cut-rectangle + "C-c C-a M-w" #'artist-select-op-copy-rectangle + "C-c C-a C-y" #'artist-select-op-paste + "C-c C-a f" #'artist-select-op-flood-fill + "C-c C-a C-b" #'artist-submit-bug-report) (easy-menu-define artist-menu-map artist-mode-map "Menu for `artist-mode'." @@ -1370,8 +1367,11 @@ Keymap summary (t ;; Turn mode on (artist-mode-init) - (let ((font (face-attribute 'default :font))) - (when (and (fontp font) (not (font-get font :spacing))) + (let* ((font (face-attribute 'default :font)) + (spacing-prop (if (fontp font) + (font-get font :spacing) + t))) + (when (or (null spacing-prop) (eq spacing-prop 0)) (message "The default font isn't monospaced, so the drawings in this buffer may look odd")))))) ;; Init and exit @@ -2840,9 +2840,8 @@ Returns a list of strings." (if (memq system-type '(windows-nt ms-dos)) (artist-figlet-get-font-list-windows) (artist-figlet-get-font-list))) - (font (completing-read (concat "Select font (default " - artist-figlet-default-font - "): ") + (font (completing-read (format-prompt "Select font" + artist-figlet-default-font) (mapcar (lambda (font) (cons font font)) avail-fonts)))) @@ -4916,7 +4915,7 @@ The event, EV, is the mouse event." (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op)) (ev-start (event-start ev)) (initial-win (posn-window ev-start)) - (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start))) + (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start t))) (x1 (artist--adjust-x (car ev-start-pos))) (y1 (cdr ev-start-pos)) (timer nil)) @@ -4932,7 +4931,7 @@ The event, EV, is the mouse event." (while (or (mouse-movement-p ev) (member 'down (event-modifiers ev))) (setq ev-start-pos (artist-coord-win-to-buf - (posn-col-row (event-start ev)))) + (posn-col-row (event-start ev) t))) (setq x1 (artist--adjust-x (car ev-start-pos))) (setq y1 (cdr ev-start-pos)) @@ -5012,7 +5011,7 @@ The event, EV, is the mouse event." (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op)) (ev-start (event-start ev)) (initial-win (posn-window ev-start)) - (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start))) + (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start t))) (x1-last (artist--adjust-x (car ev-start-pos))) (y1-last (cdr ev-start-pos)) (x2 x1-last) @@ -5104,7 +5103,7 @@ The event, EV, is the mouse event." ;; set x2 and y2 ;; (setq ev-start-pos (artist-coord-win-to-buf - (posn-col-row (event-start ev)))) + (posn-col-row (event-start ev) t))) (setq x2 (artist--adjust-x (car ev-start-pos))) (setq y2 (cdr ev-start-pos)) @@ -5131,7 +5130,7 @@ The event, EV, is the mouse event." ;; ;; set x2 and y2 (setq ev-start-pos (artist-coord-win-to-buf - (posn-col-row (event-start ev)))) + (posn-col-row (event-start ev) t))) (setq x2 (artist--adjust-x (car ev-start-pos))) (setq y2 (cdr ev-start-pos)) @@ -5215,7 +5214,8 @@ Operation is done once. The event, EV, is the mouse event." (arrow-pred (artist-go-get-arrow-pred-from-symbol op)) (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op)) (ev-start (event-start ev)) - (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start))) + (ev-start-pos (artist-coord-win-to-buf + (posn-col-row ev-start t))) (x1 (artist--adjust-x (car ev-start-pos))) (y1 (cdr ev-start-pos))) (select-window (posn-window ev-start)) @@ -5249,7 +5249,8 @@ The event, EV, is the mouse event." (arrow-set-fn (artist-go-get-arrow-set-fn-from-symbol op)) (ev-start (event-start ev)) (initial-win (posn-window ev-start)) - (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start))) + (ev-start-pos (artist-coord-win-to-buf + (posn-col-row ev-start t))) (x1 (artist--adjust-x (car ev-start-pos))) (y1 (cdr ev-start-pos)) (x2) @@ -5263,7 +5264,7 @@ The event, EV, is the mouse event." (while (or (mouse-movement-p ev) (member 'down (event-modifiers ev))) (setq ev-start-pos (artist-coord-win-to-buf - (posn-col-row (event-start ev)))) + (posn-col-row (event-start ev) t))) (setq x2 (artist--adjust-x (car ev-start-pos))) (setq y2 (cdr ev-start-pos)) @@ -5359,7 +5360,7 @@ The event, EV, is the mouse event." (setq vars (delq x vars)))) vars) (reporter-submit-bug-report artist-maintainer-address - (concat "artist.el " artist-version) + (concat "artist.el in Emacs " emacs-version) vars nil nil (concat "Hello Tomas,\n\n" @@ -5367,6 +5368,9 @@ The event, EV, is the mouse event." (define-obsolete-function-alias 'artist-uniq #'seq-uniq "28.1") +(defconst artist-version "1.2.6") +(make-obsolete-variable 'artist-version 'emacs-version "29.1") + (provide 'artist) |