From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#21777: 25.0.50; gud-gdb uses a pager, which is harmful inside emacs Date: Sun, 20 Sep 2020 23:18:32 +0200 Message-ID: <878sd4jgev.fsf@gnus.org> References: <87ziz2x0j6.fsf@secretsauce.net> <87fv0uaas1.fsf@igel.home> <87twpaha8u.fsf@secretsauce.net> <837fm53b25.fsf@gnu.org> <87pozxgu3d.fsf@secretsauce.net> <87mvv1ggwo.fsf@secretsauce.net> <83a8r022k9.fsf@gnu.org> <87lhakhg81.fsf@secretsauce.net> <838u6k1z28.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 21777@debbugs.gnu.org, schwab@linux-m68k.org, Dima Kogan To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 20 23:19:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kK6jm-0004xv-Pc for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Sep 2020 23:19:10 +0200 Original-Received: from localhost ([::1]:37208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kK6jl-000700-OR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Sep 2020 17:19:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK6je-0006zn-TW for bug-gnu-emacs@gnu.org; Sun, 20 Sep 2020 17:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kK6je-0001CY-KG for bug-gnu-emacs@gnu.org; Sun, 20 Sep 2020 17:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kK6je-0006M9-8y for bug-gnu-emacs@gnu.org; Sun, 20 Sep 2020 17:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Sep 2020 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21777 X-GNU-PR-Package: emacs Original-Received: via spool by 21777-submit@debbugs.gnu.org id=B21777.160063672924412 (code B ref 21777); Sun, 20 Sep 2020 21:19:02 +0000 Original-Received: (at 21777) by debbugs.gnu.org; 20 Sep 2020 21:18:49 +0000 Original-Received: from localhost ([127.0.0.1]:52834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kK6jR-0006Lg-Bq for submit@debbugs.gnu.org; Sun, 20 Sep 2020 17:18:49 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:37054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kK6jN-0006LR-Qo for 21777@debbugs.gnu.org; Sun, 20 Sep 2020 17:18:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rtulFcTJZilzml0CPDGr1nQsUJpqltgNPL+Ow8fcaqM=; b=GKJYGvHLw1Z830TeBOif4s7JL+ hI1VUrTPjHtnnIyhhU0CbDScF4Wbazc0XfWsGDl3P0krTY1MtJPP6hxnvWVmxObsR/r7E/Nvmm+0D MiWB3p3j+KjWaGeOp4lfKS40roTdN3p1IebF7NLyUpqwullwOxq7/n566sot0aVno/Nk=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kK6jC-00024N-4N; Sun, 20 Sep 2020 23:18:38 +0200 X-Now-Playing: Vinicius =?UTF-8?Q?Cantu=C3=A1ria's_?= =?UTF-8?Q?=5FTucum=C3=A3=5F:?= "Pra Gil" In-Reply-To: <838u6k1z28.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 30 Oct 2015 11:32:47 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188544 Archived-At: Eli Zaretskii writes: > IME, users sometimes have some use cases that look really weird to me, > but are somehow very important to them. So I'm trying to avoid > stepping on their toes as much as possible, even if I cannot imagine > those use cases in advance. I worked up a patch for this, but in testing, there's a number of problems. 1) When resizing a frame, the height in gdb is overwritten. Where does that come from? I tried grepping, but couldn't find anything. 2) Sending a command this way to gdb gives us an extra prompt, which isn't nice. 3) If you start gdb with M-x gdb instead of M-x gud-gdb, the height variable in gdb is always switched off: (gdb-input "-gdb-set height 0" 'ignore) So why shouldn't gud-gdb do the same thing? diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 7074bd45d7..ac54c570cd 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1040,6 +1040,15 @@ GDB User Interface Layout need to check that the breakpoints in recently edited source files are still in the right places. +@vindex gud-pager-height + GDB normally uses a pager when displaying output (like backtraces). +This can be inconvenient when running inside Emacs, so the default +value of @code{gud-pager-height} is @code{unlimited}, meaning that the +pager is disabled. This variable can also be a number (which is used +as the number of lines by the pager), or @code{nil}, meaning that the +pager setting shouldn't be changed from the gdb defaults (or +@file{.gdbinit} settings). + @node Source Buffers @subsubsection Source Buffers @cindex fringes, for debugging diff --git a/etc/NEWS b/etc/NEWS index 1f52341ae4..3014eddbdd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1034,6 +1034,10 @@ window after starting). This variable defaults to nil. ** Miscellaneous +*** New user option 'gud-pager-height' +This variable is used to set up the gdb pager, and defaults to +`unlimited', meaning that a pager won't be used. + +++ *** Interactive regular expression search now uses faces for sub-groups. E.g., 'C-M-s foo-\([0-9]+\)' will now use the 'isearch-group-1' face diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 84c473ddb7..7acc540b01 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -67,6 +67,19 @@ gud-key-prefix :type 'key-sequence :group 'gud) +(defcustom gud-pager-height 'unlimited + "The size of a page when gdb displays output. +gdb normally uses a pager when displaying things like +backtraces (or other things that take a lot of room). This +variable allows customizing the pager when gdb is run from Emacs. + +This can be a number (the number of lines), `unlimited' (don't +use the pager at all), or nil (don't change the defaults)." + :type '(choice (const :tag "No paging" unlimited) + integer + (const :tag "Don't set" nil)) + :version "28.1") + (global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh) ;; (define-key ctl-x-map " " 'gud-break); backward compatibility hack @@ -796,6 +809,9 @@ gud-gdb (setq gdb-first-prompt t) (setq gud-running nil) (setq gud-filter-pending-text nil) + + (when gud-pager-height + (gud-basic-call (format "set height %s" gud-pager-height))) (run-hooks 'gud-gdb-mode-hook)) ;; The completion process filter indicates when it is finished. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no