[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 015358a 001/215: Experimental: mouse2 runs eval
From: |
Rocky Bernstein |
Subject: |
[elpa] master 015358a 001/215: Experimental: mouse2 runs eval |
Date: |
Sat, 30 Jul 2016 14:48:47 +0000 (UTC) |
branch: master
commit 015358a66410cb3d7693755f1f4df0c6e91cd501
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Experimental: mouse2 runs eval
---
realgud.el | 3 ++-
realgud/common/eval.el | 64 ++++++++++++++++++++++++++++++++++++++++++++
realgud/common/shortkey.el | 4 ++-
test/test-realgud.el | 6 ++---
4 files changed, 72 insertions(+), 5 deletions(-)
diff --git a/realgud.el b/realgud.el
index 581d551..a291064 100644
--- a/realgud.el
+++ b/realgud.el
@@ -139,7 +139,8 @@
"Return a list of loaded debugger features. These are the
features that start with 'realgud-' and also include standalone debugger
features
like 'pydbgr'."
- (let ((result nil))
+ (let ((result nil)
+ (feature-str))
(dolist (feature features result)
(setq feature-str (symbol-name feature))
(cond ((eq 't
diff --git a/realgud/common/eval.el b/realgud/common/eval.el
new file mode 100644
index 0000000..2d851a3
--- /dev/null
+++ b/realgud/common/eval.el
@@ -0,0 +1,64 @@
+;; show expressions using tooltip
+
+;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see
+;; <http://www.gnu.org/licenses/>.
+
+(require 'load-relative)
+(require 'tooltip)
+
+(require-relative-list '("cmds" "helper") "realgud-")
+
+(declare-function realgud:cmd-eval 'realgud-cmd)
+(declare-function realgud-get-cmdbuf 'realgud-helper)
+
+(defun realgud:tooltip-eval (event)
+ "Show tip for identifier or selection under the mouse.
+The mouse must either point at an identifier or inside a selected
+region for the tip window to be shown.
+
+This function must return nil if it doesn't handle EVENT."
+ (interactive "e")
+ (let ((process)
+ (cmdbuf (realgud-get-cmdbuf))
+ (process))
+ (when (and (eventp event)
+ cmdbuf
+ (setq process (get-buffer-process cmdbuf))
+ (posn-point (event-end event))
+ )
+ (let ((expr (tooltip-expr-to-print event))
+ (original-filter (process-filter process)))
+ (when expr
+ (set-process-filter process 'realgud:eval-process-output)
+ (realgud:cmd-eval expr)
+ ))
+ )))
+
+(defun realgud:eval-process-output (process output)
+ "Process debugger output and show it in a tooltip window."
+ (set-process-filter process 'comint-output-filter)
+ (with-current-buffer (realgud-get-cmdbuf)
+ (goto-char (process-mark process))
+ (insert output)
+ (set-marker (process-mark process) (point)))
+ (setq comint-last-output-start
+ (setq realgud-last-output-start (process-mark process)))
+
+ (tooltip-show (tooltip-strip-prompt process output))
+ )
+
+(provide-me "realgud-")
diff --git a/realgud/common/shortkey.el b/realgud/common/shortkey.el
index 812f890..74e86be 100644
--- a/realgud/common/shortkey.el
+++ b/realgud/common/shortkey.el
@@ -1,6 +1,7 @@
;;; Copyright (C) 2010-2015 Rocky Bernstein <address@hidden>
(require 'load-relative)
-(require-relative-list '("custom" "helper" "key" "lochist" "loc" "menu")
+(require-relative-list '("custom" "eval" "helper" "key" "lochist" "loc"
+ "menu")
"realgud-")
(require-relative-list '("buffer/command" "buffer/helper" "buffer/source")
"realgud-buffer-")
@@ -44,6 +45,7 @@
(define-key map "c" 'realgud:cmd-continue)
(define-key map "e" 'realgud:cmd-eval-region)
(define-key map "U" 'realgud:cmd-until)
+ (define-key map [mouse-2] 'realgud:tooltip-eval)
;; FIXME: these can go to a common routine
(define-key map "<" 'realgud:cmd-newer-frame)
diff --git a/test/test-realgud.el b/test/test-realgud.el
index a4e5578..ed8e845 100644
--- a/test/test-realgud.el
+++ b/test/test-realgud.el
@@ -15,9 +15,9 @@
(note "realgud:loaded-features")
(set (make-local-variable 'test-realgud:features) (realgud:loaded-features))
-(dolist (feature '(realgud-trepan realgud-pydbgr
- realgud-core))
- (assert-t (not (not (member feature test-realgud:features)))) )
+;; (dolist (feature '(realgud-trepan realgud-pydbgr
+;; realgud-core))
+;; (assert-t (not (not (member feature test-realgud:features)))) )
(note "realgud-unload-features")
(load-file "../realgud.el")
- [elpa] master updated (5f5f2bb -> 8edfb04), Rocky Bernstein, 2016/07/30
- [elpa] master fc84e01 002/215: In pdb, for to evaluate an expression use "p", Rocky Bernstein, 2016/07/30
- [elpa] master 015358a 001/215: Experimental: mouse2 runs eval,
Rocky Bernstein <=
- [elpa] master 1994f09 004/215: Move test helper into test, Rocky Bernstein, 2016/07/30
- [elpa] master f153e3f 008/215: gdb's "eval" is "print"., Rocky Bernstein, 2016/07/30
- [elpa] master f71fd11 003/215: Remove another warning, Rocky Bernstein, 2016/07/30
- [elpa] master 7be15d2 011/215: Try to fix travis #2, Rocky Bernstein, 2016/07/30
- [elpa] master 4208a33 010/215: Fix logic for finding region to work on in tracking, Rocky Bernstein, 2016/07/30
- [elpa] master f55c074 018/215: Fix downcase., Rocky Bernstein, 2016/07/30
- [elpa] master 2f66cb0 007/215: Make realugd:process-filter-save buffer local, Rocky Bernstein, 2016/07/30
- [elpa] master 3e9e1ac 005/215: Work on filtering eval output, Rocky Bernstein, 2016/07/30
- [elpa] master b7adbc0 019/215: DRY Comment no longer relvant, Rocky Bernstein, 2016/07/30
- [elpa] master 1924ded 012/215: Try to fix travis #3, Rocky Bernstein, 2016/07/30