emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New function for gdb-ui.el?


From: Kim F. Storm
Subject: Re: New function for gdb-ui.el?
Date: Mon, 24 Oct 2005 13:46:42 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Nick Roberts <address@hidden> 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 <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]