From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "richardeng" Newsgroups: gmane.emacs.devel Subject: New function: what-file-line, used when writing gdb script Date: Sun, 23 Nov 2008 11:49:10 +0800 Message-ID: <200811231149099428787@foxmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====003_Dragon074583555657_=====" X-Trace: ger.gmane.org 1227412184 11284 80.91.229.12 (23 Nov 2008 03:49:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Nov 2008 03:49:44 +0000 (UTC) To: "emacs-devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 23 04:50:47 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L45zf-0003ic-M7 for ged-emacs-devel@m.gmane.org; Sun, 23 Nov 2008 04:50:43 +0100 Original-Received: from localhost ([127.0.0.1]:47495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L45yU-0004r6-DR for ged-emacs-devel@m.gmane.org; Sat, 22 Nov 2008 22:49:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L45yO-0004qr-Gb for emacs-devel@gnu.org; Sat, 22 Nov 2008 22:49:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L45yM-0004qf-Iv for emacs-devel@gnu.org; Sat, 22 Nov 2008 22:49:23 -0500 Original-Received: from [199.232.76.173] (port=34065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L45yM-0004qc-DY for emacs-devel@gnu.org; Sat, 22 Nov 2008 22:49:22 -0500 Original-Received: from smtpbg1.foxmail.com ([58.61.33.111]:49328) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1L45yL-00012F-A0 for emacs-devel@gnu.org; Sat, 22 Nov 2008 22:49:22 -0500 Original-Received: from 172.23.147.140 (foxmail.com [172.23.147.140]) by smtpbg1 (foxmail.com) with SMTP id dSxuAsLr; Sun, 23 Nov 2008 11:49:09 +0800 (envelope-from richardeng@foxmail.com) X-QQ-mid: esmtp5122741214944121429 Original-Received: from 889D3A80E680420 (unknown [116.225.239.173]) by smtp.foxmail.com (Postfix) with ESMTP id for ; Sun, 23 Nov 2008 11:49:09 +0800 (CST) X-mailer: Foxmail 6, 14, 103, 20 [cn] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:105983 Archived-At: This is a multi-part message in MIME format. --=====003_Dragon074583555657_===== Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Hi all, When I write gdb script, I need to set many breakpoints. such as: b xxx_file.c:xxx_line_number With following comamnd, I can do it more easy ----- (defcustom what-file-line-separator ":" "Define the separator between file name and line number" :type 'string :group 'editing) (defcustom what-file-line-yankp nil "Toggle on/off Yank to kill ring" :type 'boolean :group 'editing) ;; Maybe this variable is useless, user can copy what they want in mini-buffer (defcustom what-file-line-fullpath t "Toggle on/off file name fullpath" :type 'boolean :group 'editing) (defun what-file-line () "Print the current buffer's file name and line nubmer" (interactive) (let ((n (line-number-at-pos)) (file (buffer-file-name)) result) (setq result (concat file what-file-line-separator (number-to-string n))) (message "%s" result) (if what-file-line-yankp (kill-new result)))) ----- Q: 1. I don't know in which group the customized variables should be put? 2. The 3rd customized variable needn't, agree? 3. If this functionality is usefull, I want to implement a GUI version(as same as gdb-mouse-set-clear-breakpoint). So when user click the left margin when non-gdb-mode, user can get the filename-line pair) What's your comment? 2008-11-23 richardeng --=====003_Dragon074583555657_===== Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: 7bit
Hi all,
 
When I write gdb script, I need to set many breakpoints. such as:
b xxx_file.c:xxx_line_number
 
With following comamnd, I can do it more easy
-----
(defcustom what-file-line-separator ":"
  "Define the separator between file name and line number"
  :type 'string
  :group 'editing)
 
(defcustom what-file-line-yankp nil
  "Toggle on/off Yank to kill ring"
  :type 'boolean
  :group 'editing)
 
;; Maybe this variable is useless, user can copy what they want in mini-buffer                                  
(defcustom what-file-line-fullpath t
  "Toggle on/off file name fullpath"
  :type 'boolean
  :group 'editing)
 
(defun what-file-line ()
  "Print the current buffer's file name and line nubmer"
  (interactive)
  (let ((n (line-number-at-pos))
        (file (buffer-file-name))
        result)
    (setq result (concat file what-file-line-separator (number-to-string n)))
    (message "%s" result)
    (if what-file-line-yankp
        (kill-new result))))
-----
Q:
1. I don't know in which group the customized variables should be put?
2. The 3rd customized variable needn't, agree?
3. If this functionality is usefull, I want to implement a GUI version(as same as gdb-mouse-set-clear-breakpoint). So when user click the left margin when non-gdb-mode, user can get the filename-line pair)
 
What's your comment?
 
 
2008-11-23

richardeng
--=====003_Dragon074583555657_=====--