* bug#795: Artist: patch 1 (of 2): Cut/copy menu selection bugfix @ 2008-08-27 12:49 ` Tomas Abrahamsson 2008-08-27 17:30 ` bug#795: marked as done (Artist: patch 1 (of 2): Cut/copy menu selection bugfix) Emacs bug Tracking System 0 siblings, 1 reply; 4+ messages in thread From: Tomas Abrahamsson @ 2008-08-27 12:49 UTC (permalink / raw) To: bug-gnu-emacs Hi, This is the first of two patches for emacs/lisp/textmodes/artist.el. The patches do not depend on each other. They fix different bugs, but they apply to the same file. The patch is against 1.40 of artist.el as checked out from :pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs The patch is written entirely by me. Bug was found by me. As far as I know, the bug has not been reported anywhere. The bug that this patch fixes is: with the mouse, it was impossible to select the copy and cut operations in the menu. This patch makes it possible to do that. Below is a ChangeLog entry and the patch itself. For the ChangeLog entry, I looked at emacs/lisp/ChangeLog and tried to follow the style therein. (I don't know what's the common practice with the first line (date and name), though since I assume it will be someone else but me who will check this in.) If anythning is unclear or needs more work, please contact me. BRs Tomas The ChangeLog entry: 2008-08-27 Tomas Abrahamsson <tab@lysator.liu.se> * textmodes/artist.el (artist-mt): Fixed structures for cut and copy operations. The patch: Index: artist.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/artist.el,v retrieving revision 1.40 diff -u -r1.40 artist.el --- artist.el 12 Jun 2008 03:56:20 -0000 1.40 +++ artist.el 26 Aug 2008 23:34:05 -0000 @@ -723,14 +723,14 @@ 2 artist-draw-rect (artist-undraw-rect - artist-t artist-cut-rect) + artist-t artist-cut-rect)) ("cut square" cut-s "cut-s" artist-no-arrows nil nil nil nil 2 artist-draw-square (artist-undraw-square - artist-t artist-cut-square)))))) + artist-t artist-cut-square))))) (graphics-operation ("Copy" (("copy rectangle" copy-r "copy-r" @@ -739,14 +739,14 @@ 2 artist-draw-rect (artist-undraw-rect - artist-t artist-copy-rect) + artist-t artist-copy-rect)) ("copy square" copy-s "copy-s" artist-no-arrows nil nil nil nil 2 artist-draw-square (artist-undraw-square - artist-t artist-copy-square)))))) + artist-t artist-copy-square))))) (graphics-operation ("Paste" (("paste" paste "paste" ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#795: marked as done (Artist: patch 1 (of 2): Cut/copy menu selection bugfix) 2008-08-27 12:49 ` bug#795: Artist: patch 1 (of 2): Cut/copy menu selection bugfix Tomas Abrahamsson @ 2008-08-27 17:30 ` Emacs bug Tracking System 0 siblings, 0 replies; 4+ messages in thread From: Emacs bug Tracking System @ 2008-08-27 17:30 UTC (permalink / raw) To: Chong Yidong [-- Attachment #1: Type: text/plain, Size: 868 bytes --] Your message dated Wed, 27 Aug 2008 13:27:07 -0400 with message-id <87y72iz7v8.fsf@cyd.mit.edu> and subject line Re: Artist: patch 2 (of 2): Fix for args-out-of-range error has caused the Emacs bug report #795, regarding Artist: patch 1 (of 2): Cut/copy menu selection bugfix to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) -- 795: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=795 Emacs Bug Tracking System Contact don@donarmstrong.com with problems [-- Attachment #2: Type: message/rfc822, Size: 4688 bytes --] From: Tomas Abrahamsson <tab@lysator.liu.se> To: bug-gnu-emacs@gnu.org Subject: Artist: patch 1 (of 2): Cut/copy menu selection bugfix Date: Wed, 27 Aug 2008 14:49:51 +0200 Message-ID: <uqr68azkpc.fsf@sellafield.lysator.liu.se> Hi, This is the first of two patches for emacs/lisp/textmodes/artist.el. The patches do not depend on each other. They fix different bugs, but they apply to the same file. The patch is against 1.40 of artist.el as checked out from :pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs The patch is written entirely by me. Bug was found by me. As far as I know, the bug has not been reported anywhere. The bug that this patch fixes is: with the mouse, it was impossible to select the copy and cut operations in the menu. This patch makes it possible to do that. Below is a ChangeLog entry and the patch itself. For the ChangeLog entry, I looked at emacs/lisp/ChangeLog and tried to follow the style therein. (I don't know what's the common practice with the first line (date and name), though since I assume it will be someone else but me who will check this in.) If anythning is unclear or needs more work, please contact me. BRs Tomas The ChangeLog entry: 2008-08-27 Tomas Abrahamsson <tab@lysator.liu.se> * textmodes/artist.el (artist-mt): Fixed structures for cut and copy operations. The patch: Index: artist.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/artist.el,v retrieving revision 1.40 diff -u -r1.40 artist.el --- artist.el 12 Jun 2008 03:56:20 -0000 1.40 +++ artist.el 26 Aug 2008 23:34:05 -0000 @@ -723,14 +723,14 @@ 2 artist-draw-rect (artist-undraw-rect - artist-t artist-cut-rect) + artist-t artist-cut-rect)) ("cut square" cut-s "cut-s" artist-no-arrows nil nil nil nil 2 artist-draw-square (artist-undraw-square - artist-t artist-cut-square)))))) + artist-t artist-cut-square))))) (graphics-operation ("Copy" (("copy rectangle" copy-r "copy-r" @@ -739,14 +739,14 @@ 2 artist-draw-rect (artist-undraw-rect - artist-t artist-copy-rect) + artist-t artist-copy-rect)) ("copy square" copy-s "copy-s" artist-no-arrows nil nil nil nil 2 artist-draw-square (artist-undraw-square - artist-t artist-copy-square)))))) + artist-t artist-copy-square))))) (graphics-operation ("Paste" (("paste" paste "paste" [-- Attachment #3: Type: message/rfc822, Size: 1243 bytes --] From: Chong Yidong <cyd@stupidchicken.com> To: Tomas Abrahamsson <tab@lysator.liu.se> Cc: 794-done@emacsbugs.donarmstrong.com, 795-done@emacsbugs.donarmstrong.com Subject: Re: Artist: patch 2 (of 2): Fix for args-out-of-range error Date: Wed, 27 Aug 2008 13:27:07 -0400 Message-ID: <87y72iz7v8.fsf@cyd.mit.edu> > This is the second of two patches for emacs/lisp/textmodes/artist.el. > The patches do not depend on each other. They fix different bugs, but > they apply to the same file. I've checked in both patches into CVS trunk. Thanks very much. ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#794: Artist: patch 2 (of 2): Fix for args-out-of-range error @ 2008-08-27 12:49 ` Tomas Abrahamsson 2008-08-27 17:30 ` bug#794: marked as done (Artist: patch 2 (of 2): Fix for args-out-of-range error) Emacs bug Tracking System 0 siblings, 1 reply; 4+ messages in thread From: Tomas Abrahamsson @ 2008-08-27 12:49 UTC (permalink / raw) To: bug-gnu-emacs Hi, This is the second of two patches for emacs/lisp/textmodes/artist.el. The patches do not depend on each other. They fix different bugs, but they apply to the same file. The patch is against 1.40 of artist.el as checked out from :pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs The patch is written entirely by me. The bug was found by Rubén Berenguel <ruben@maia.ub.es> and reported in a private mail to me. As far as I know, the bug has not been reported anywhere else. The bug that this patch fixes is: With e.g. the spray-can mode, using characters whose internal representation was >= 256 caused an args-out-of-range error. This is now fixed. Below is a ChangeLog entry and the patch itself. If anythning is unclear or needs more work, please contact me. BRs Tomas The ChangeLog entry: 2008-08-27 Tomas Abrahamsson <tab@lysator.liu.se> * textmodes/artist.el (artist-mode-init): Added comment on the setting up of the `artist-replacement-table' array. (artist-get-replacement-char): New. (artist-get-char-at-xy-conv, artist-replace-char) (artist-replace-chars, artist-replace-string): Use it instead of accessing `artist-replacement-table' directly. Reported by Rubén Berenguel <ruben@maia.ub.es>. The patch: Index: artist.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/artist.el,v retrieving revision 1.40 diff -u -r1.40 artist.el --- artist.el 12 Jun 2008 03:56:20 -0000 1.40 +++ artist.el 26 Aug 2008 23:34:09 -0000 @@ -1375,6 +1375,9 @@ ;; Init and exit (defun artist-mode-init () "Init Artist mode. This will call the hook `artist-mode-init-hook'." + ;; Set up a conversion table for mapping tabs and new-lines to spaces. + ;; the last case, 0, is for the last position in buffer/region, where + ;; the `following-char' function returns 0. (let ((i 0)) (while (< i 256) (aset artist-replacement-table i i) @@ -1382,6 +1385,7 @@ (aset artist-replacement-table ?\n ?\s) (aset artist-replacement-table ?\t ?\s) (aset artist-replacement-table 0 ?\s) + ;; More setup (make-local-variable 'artist-key-is-drawing) (make-local-variable 'artist-key-endpoint1) (make-local-variable 'artist-key-poly-point-list) @@ -1944,10 +1948,21 @@ (following-char)) +(defsubst artist-get-replacement-char (c) + "Retrieve a replacement for character C from `artist-replacement-table'. +The replacement is used to convert tabs and new-lines to spaces." + ;; Characters may be outside the range of the `artist-replacement-table', + ;; for example if they are unicode code points >= 256. + ;; Check so we don't attempt to access the array out of its bounds, + ;; assuming no such character needs to be replaced. + (if (< c (length artist-replacement-table)) + (aref artist-replacement-table c) + c)) + (defun artist-get-char-at-xy-conv (x y) "Retrieve the character at X, Y, converting tabs and new-lines to spaces." (save-excursion - (aref artist-replacement-table (artist-get-char-at-xy x y)))) + (artist-get-replacement-char (artist-get-char-at-xy x y)))) (defun artist-replace-char (new-char) @@ -1963,12 +1978,12 @@ (artist-move-to-xy (1+ (artist-current-column)) (artist-current-line)) (delete-char -1) - (insert (aref artist-replacement-table new-char))) + (insert (artist-get-replacement-char new-char))) ;; In emacs-19, the self-insert-command works better and faster (let ((overwrite-mode 'overwrite-mode-textual) (fill-column 32765) ; Large :-) (blink-matching-paren nil)) - (setq last-command-event (aref artist-replacement-table new-char)) + (setq last-command-event (artist-get-replacement-char new-char)) (self-insert-command 1)))) (defun artist-replace-chars (new-char count) @@ -1980,7 +1995,7 @@ ;; The self-insert-command doesn't care about the overwrite-mode, ;; so the insertion is done in the same way as in picture mode. ;; This seems to be a little bit slower. - (let* ((replaced-c (aref artist-replacement-table new-char)) + (let* ((replaced-c (artist-get-replacement-char new-char)) (replaced-s (make-string count replaced-c))) (artist-move-to-xy (+ (artist-current-column) count) (artist-current-line)) @@ -1990,7 +2005,7 @@ (let ((overwrite-mode 'overwrite-mode-textual) (fill-column 32765) ; Large :-) (blink-matching-paren nil)) - (setq last-command-event (aref artist-replacement-table new-char)) + (setq last-command-event (artist-get-replacement-char new-char)) (self-insert-command count)))) (defsubst artist-replace-string (string &optional see-thru) @@ -2003,7 +2018,7 @@ (blink-matching-paren nil)) (while char-list (let ((c (car char-list))) - (if (and see-thru (= (aref artist-replacement-table c) ?\s)) + (if (and see-thru (= (artist-get-replacement-char c) ?\s)) (artist-move-to-xy (1+ (artist-current-column)) (artist-current-line)) (artist-replace-char c))) ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#794: marked as done (Artist: patch 2 (of 2): Fix for args-out-of-range error) 2008-08-27 12:49 ` bug#794: Artist: patch 2 (of 2): Fix for args-out-of-range error Tomas Abrahamsson @ 2008-08-27 17:30 ` Emacs bug Tracking System 0 siblings, 0 replies; 4+ messages in thread From: Emacs bug Tracking System @ 2008-08-27 17:30 UTC (permalink / raw) To: Chong Yidong [-- Attachment #1: Type: text/plain, Size: 869 bytes --] Your message dated Wed, 27 Aug 2008 13:27:07 -0400 with message-id <87y72iz7v8.fsf@cyd.mit.edu> and subject line Re: Artist: patch 2 (of 2): Fix for args-out-of-range error has caused the Emacs bug report #794, regarding Artist: patch 2 (of 2): Fix for args-out-of-range error to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) -- 794: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=794 Emacs Bug Tracking System Contact don@donarmstrong.com with problems [-- Attachment #2: Type: message/rfc822, Size: 7700 bytes --] From: Tomas Abrahamsson <tab@lysator.liu.se> To: bug-gnu-emacs@gnu.org Subject: Artist: patch 2 (of 2): Fix for args-out-of-range error Date: Wed, 27 Aug 2008 14:49:56 +0200 Message-ID: <uqprnuzkp7.fsf@sellafield.lysator.liu.se> Hi, This is the second of two patches for emacs/lisp/textmodes/artist.el. The patches do not depend on each other. They fix different bugs, but they apply to the same file. The patch is against 1.40 of artist.el as checked out from :pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs The patch is written entirely by me. The bug was found by Rubén Berenguel <ruben@maia.ub.es> and reported in a private mail to me. As far as I know, the bug has not been reported anywhere else. The bug that this patch fixes is: With e.g. the spray-can mode, using characters whose internal representation was >= 256 caused an args-out-of-range error. This is now fixed. Below is a ChangeLog entry and the patch itself. If anythning is unclear or needs more work, please contact me. BRs Tomas The ChangeLog entry: 2008-08-27 Tomas Abrahamsson <tab@lysator.liu.se> * textmodes/artist.el (artist-mode-init): Added comment on the setting up of the `artist-replacement-table' array. (artist-get-replacement-char): New. (artist-get-char-at-xy-conv, artist-replace-char) (artist-replace-chars, artist-replace-string): Use it instead of accessing `artist-replacement-table' directly. Reported by Rubén Berenguel <ruben@maia.ub.es>. The patch: Index: artist.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/artist.el,v retrieving revision 1.40 diff -u -r1.40 artist.el --- artist.el 12 Jun 2008 03:56:20 -0000 1.40 +++ artist.el 26 Aug 2008 23:34:09 -0000 @@ -1375,6 +1375,9 @@ ;; Init and exit (defun artist-mode-init () "Init Artist mode. This will call the hook `artist-mode-init-hook'." + ;; Set up a conversion table for mapping tabs and new-lines to spaces. + ;; the last case, 0, is for the last position in buffer/region, where + ;; the `following-char' function returns 0. (let ((i 0)) (while (< i 256) (aset artist-replacement-table i i) @@ -1382,6 +1385,7 @@ (aset artist-replacement-table ?\n ?\s) (aset artist-replacement-table ?\t ?\s) (aset artist-replacement-table 0 ?\s) + ;; More setup (make-local-variable 'artist-key-is-drawing) (make-local-variable 'artist-key-endpoint1) (make-local-variable 'artist-key-poly-point-list) @@ -1944,10 +1948,21 @@ (following-char)) +(defsubst artist-get-replacement-char (c) + "Retrieve a replacement for character C from `artist-replacement-table'. +The replacement is used to convert tabs and new-lines to spaces." + ;; Characters may be outside the range of the `artist-replacement-table', + ;; for example if they are unicode code points >= 256. + ;; Check so we don't attempt to access the array out of its bounds, + ;; assuming no such character needs to be replaced. + (if (< c (length artist-replacement-table)) + (aref artist-replacement-table c) + c)) + (defun artist-get-char-at-xy-conv (x y) "Retrieve the character at X, Y, converting tabs and new-lines to spaces." (save-excursion - (aref artist-replacement-table (artist-get-char-at-xy x y)))) + (artist-get-replacement-char (artist-get-char-at-xy x y)))) (defun artist-replace-char (new-char) @@ -1963,12 +1978,12 @@ (artist-move-to-xy (1+ (artist-current-column)) (artist-current-line)) (delete-char -1) - (insert (aref artist-replacement-table new-char))) + (insert (artist-get-replacement-char new-char))) ;; In emacs-19, the self-insert-command works better and faster (let ((overwrite-mode 'overwrite-mode-textual) (fill-column 32765) ; Large :-) (blink-matching-paren nil)) - (setq last-command-event (aref artist-replacement-table new-char)) + (setq last-command-event (artist-get-replacement-char new-char)) (self-insert-command 1)))) (defun artist-replace-chars (new-char count) @@ -1980,7 +1995,7 @@ ;; The self-insert-command doesn't care about the overwrite-mode, ;; so the insertion is done in the same way as in picture mode. ;; This seems to be a little bit slower. - (let* ((replaced-c (aref artist-replacement-table new-char)) + (let* ((replaced-c (artist-get-replacement-char new-char)) (replaced-s (make-string count replaced-c))) (artist-move-to-xy (+ (artist-current-column) count) (artist-current-line)) @@ -1990,7 +2005,7 @@ (let ((overwrite-mode 'overwrite-mode-textual) (fill-column 32765) ; Large :-) (blink-matching-paren nil)) - (setq last-command-event (aref artist-replacement-table new-char)) + (setq last-command-event (artist-get-replacement-char new-char)) (self-insert-command count)))) (defsubst artist-replace-string (string &optional see-thru) @@ -2003,7 +2018,7 @@ (blink-matching-paren nil)) (while char-list (let ((c (car char-list))) - (if (and see-thru (= (aref artist-replacement-table c) ?\s)) + (if (and see-thru (= (artist-get-replacement-char c) ?\s)) (artist-move-to-xy (1+ (artist-current-column)) (artist-current-line)) (artist-replace-char c))) [-- Attachment #3: Type: message/rfc822, Size: 1219 bytes --] From: Chong Yidong <cyd@stupidchicken.com> To: Tomas Abrahamsson <tab@lysator.liu.se> Cc: 794-done@emacsbugs.donarmstrong.com, 795-done@emacsbugs.donarmstrong.com Subject: Re: Artist: patch 2 (of 2): Fix for args-out-of-range error Date: Wed, 27 Aug 2008 13:27:07 -0400 Message-ID: <87y72iz7v8.fsf@cyd.mit.edu> > This is the second of two patches for emacs/lisp/textmodes/artist.el. > The patches do not depend on each other. They fix different bugs, but > they apply to the same file. I've checked in both patches into CVS trunk. Thanks very much. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-27 17:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <87y72iz7v8.fsf@cyd.mit.edu> 2008-08-27 12:49 ` bug#795: Artist: patch 1 (of 2): Cut/copy menu selection bugfix Tomas Abrahamsson 2008-08-27 17:30 ` bug#795: marked as done (Artist: patch 1 (of 2): Cut/copy menu selection bugfix) Emacs bug Tracking System 2008-08-27 12:49 ` bug#794: Artist: patch 2 (of 2): Fix for args-out-of-range error Tomas Abrahamsson 2008-08-27 17:30 ` bug#794: marked as done (Artist: patch 2 (of 2): Fix for args-out-of-range error) Emacs bug Tracking System
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.