From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: New function for gdb-ui.el? Date: Mon, 24 Oct 2005 13:46:42 +0200 Message-ID: References: <17243.21638.138477.436126@kahikatea.snap.net.nz> <17243.61878.582737.703030@kahikatea.snap.net.nz> <20051024063354.419F683AE@kahikatea.snap.net.nz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130158836 9032 80.91.229.2 (24 Oct 2005 13:00:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Oct 2005 13:00:36 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 24 15:00:32 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EU1vV-0006oU-LI for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2005 14:59:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EU1vV-0005wu-18 for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2005 08:59:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EU0ni-0006vp-Kf for emacs-devel@gnu.org; Mon, 24 Oct 2005 07:47:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EU0nh-0006up-CX for emacs-devel@gnu.org; Mon, 24 Oct 2005 07:47:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EU0ng-0006uc-M7 for emacs-devel@gnu.org; Mon, 24 Oct 2005 07:47:37 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EU0nf-0005pr-MJ; Mon, 24 Oct 2005 07:47:36 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepa.post.tele.dk (Postfix) with SMTP id 1412F47FED0; Mon, 24 Oct 2005 13:47:33 +0200 (CEST) Original-To: Nick Roberts In-Reply-To: <20051024063354.419F683AE@kahikatea.snap.net.nz> (Nick Roberts's message of "Mon, 24 Oct 2005 19:33:54 +1300 (NZDT)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44704 Archived-At: Nick Roberts writes: > > > At the moment gud-until is on the tool-bar (execution continues to point) > > > but clicking with mouse-1 in the fringe sets/clears a breakpoint. In the > > > display margin, mouse-3 toggles an existing breakpoint. I would like to > > > do that in the fringe too, but currently I dont think you can give > > > bitmaps properties in Emacs (I use text properties for the breakpoint > > > icons in the margin). > > > > Can't you put the property on the "invisible" character that you add > > to show the bitmap? > > I don't think there is an "invisible" character in the fringe. I discussed > this briefly with you at the start of the year (Fringe/margin issues). > (posn-string posn) always returns nil in the fringe. > See the patch below which uses the invisible character in the buffer... > It would also help if the buffer scrolled when you drag past the mode line > while in the fringe, just as it does in the text area. Sure! But if people agree that a mouse-2 click in the left fringe is the way to do this, it is not necessary... *** gdb-ui.el 24 Oct 2005 11:18:01 +0200 1.98 --- gdb-ui.el 24 Oct 2005 13:40:24 +0200 *************** *** 350,359 **** (define-key gud-minor-mode-map [left-fringe mouse-1] 'gdb-mouse-set-clear-breakpoint) (define-key gud-minor-mode-map [left-margin mouse-3] ! 'gdb-mouse-toggle-breakpoint) ! ; Currently only works in margin. ! ; (define-key gud-minor-mode-map [left-fringe mouse-3] ! ; 'gdb-mouse-toggle-breakpoint) (setq comint-input-sender 'gdb-send) ;; --- 350,358 ---- (define-key gud-minor-mode-map [left-fringe mouse-1] 'gdb-mouse-set-clear-breakpoint) (define-key gud-minor-mode-map [left-margin mouse-3] ! 'gdb-mouse-toggle-breakpoint-margin) ! (define-key gud-minor-mode-map [left-fringe mouse-3] ! 'gdb-mouse-toggle-breakpoint-fringe) (setq comint-input-sender 'gdb-send) ;; *************** *** 1400,1407 **** (gud-remove nil) (gud-break nil))))))) ! (defun gdb-mouse-toggle-breakpoint (event) ! "Enable/disable breakpoint in left fringe/margin with mouse click." (interactive "e") (mouse-minibuffer-check event) (let ((posn (event-end event))) --- 1399,1406 ---- (gud-remove nil) (gud-break nil))))))) ! (defun gdb-mouse-toggle-breakpoint-margin (event) ! "Enable/disable breakpoint in left margin with mouse click." (interactive "e") (mouse-minibuffer-check event) (let ((posn (event-end event))) *************** *** 1419,1425 **** 0 'gdb-enabled (car (posn-string posn))) "disable " "enable ") ! bptno "\n")) 'ignore)))))))) (defun gdb-breakpoints-buffer-name () (with-current-buffer gud-comint-buffer --- 1418,1450 ---- 0 'gdb-enabled (car (posn-string posn))) "disable " "enable ") ! bptno "\n")) ! 'ignore)))))))) ! ! (defun gdb-mouse-toggle-breakpoint-fringe (event) ! "Enable/disable breakpoint in left fringe with mouse click." ! (interactive "e") ! (mouse-minibuffer-check event) ! (let* ((posn (event-end event)) ! (pos (posn-point posn)) ! obj) ! (when (numberp pos) ! (with-selected-window (posn-window posn) ! (save-excursion ! (set-buffer (window-buffer (selected-window))) ! (goto-char pos) ! (dolist (overlay (overlays-in pos pos)) ! (when (overlay-get overlay 'put-break) ! (setq obj (overlay-get overlay 'before-string)))) ! (when (stringp obj) ! (gdb-enqueue-input ! (list ! (concat ! (if (get-text-property 0 'gdb-enabled obj) ! "disable " ! "enable ") ! (get-text-property 0 'gdb-bptno obj) "\n") ! 'ignore)))))))) (defun gdb-breakpoints-buffer-name () (with-current-buffer gud-comint-buffer *************** *** 2456,2462 **** (error (setq gdb-find-file-unhook t))))) ;;from put-image ! (defun gdb-put-string (putstring pos &optional dprop) "Put string PUTSTRING in front of POS in the current buffer. PUTSTRING is displayed by putting an overlay into the current buffer with a `before-string' string that has a `display' property whose value is --- 2481,2487 ---- (error (setq gdb-find-file-unhook t))))) ;;from put-image ! (defun gdb-put-string (putstring pos &optional dprop &rest sprops) "Put string PUTSTRING in front of POS in the current buffer. PUTSTRING is displayed by putting an overlay into the current buffer with a `before-string' string that has a `display' property whose value is *************** *** 2467,2473 **** (let ((overlay (make-overlay pos pos buffer)) (prop (or dprop (list (list 'margin 'left-margin) putstring)))) ! (put-text-property 0 (length string) 'display prop string) (overlay-put overlay 'put-break t) (overlay-put overlay 'before-string string)))) --- 2492,2500 ---- (let ((overlay (make-overlay pos pos buffer)) (prop (or dprop (list (list 'margin 'left-margin) putstring)))) ! (put-text-property 0 1 'display prop string) ! (if sprops ! (add-text-properties 0 1 sprops string)) (overlay-put overlay 'put-break t) (overlay-put overlay 'before-string string)))) *************** *** 2490,2510 **** (add-text-properties 0 1 '(help-echo "mouse-1: set/clear bkpt, mouse-3: enable/disable bkpt") putstring) ! (if enabled (add-text-properties ! 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring) (add-text-properties 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) (gdb-remove-breakpoint-icons start end) (if (display-images-p) (if (>= (or left-fringe-width ! (if source-window (car (window-fringes source-window))) ! gdb-buffer-fringe-width) 8) (gdb-put-string nil (1+ start) `(left-fringe breakpoint ,(if enabled 'breakpoint-enabled ! 'breakpoint-disabled))) (when (< left-margin-width 2) (save-current-buffer (setq left-margin-width 2) --- 2517,2540 ---- (add-text-properties 0 1 '(help-echo "mouse-1: set/clear bkpt, mouse-3: enable/disable bkpt") putstring) ! (if enabled ! (add-text-properties ! 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring) (add-text-properties 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) (gdb-remove-breakpoint-icons start end) (if (display-images-p) (if (>= (or left-fringe-width ! (if source-window (car (window-fringes source-window))) ! gdb-buffer-fringe-width) 8) (gdb-put-string nil (1+ start) `(left-fringe breakpoint ,(if enabled 'breakpoint-enabled ! 'breakpoint-disabled)) ! 'gdb-bptno bptno ! 'gdb-enabled enabled) (when (< left-margin-width 2) (save-current-buffer (setq left-margin-width 2) -- Kim F. Storm http://www.cua.dk