From f6a455d083ec06728ff6cb72257521f22624dfe9 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 29 Apr 2020 22:46:56 +0200
Subject: [PATCH] =?UTF-8?q?Am=C3=A9rliorations=20pour=20GUD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Affiche les icones si gud est lancé.
- Supprime les numéros de lignes dans gud et dans la speedbar
---
 Configuration.org  |  16 +++-
 extra/tool-bar+.el | 222 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 236 insertions(+), 2 deletions(-)
 create mode 100644 extra/tool-bar+.el

diff --git a/Configuration.org b/Configuration.org
index e0df04a..0888eb6 100644
--- a/Configuration.org
+++ b/Configuration.org
@@ -1,3 +1,4 @@
+
 #+SETUPFILE: ~/.emacs.d/org-html-themes/setup/theme-readtheorg-local.setup
 
 #+STARTUP: org-pretty-entities entitiespretty
@@ -38,11 +39,20 @@
                 (setq gc-cons-threshold 800000)))
 #+END_SRC
 
-** Pas de toolbar
+** /toolbar/
+Elle est déactivée par défaut
 #+BEGIN_SRC emacs-lisp
   (tool-bar-mode -1)
 #+END_SRC
 
+Elle est néanmoins lancée lorsque ~gud~ (l'interface à ~gdb~ dans Emacs)
+est actif.
+#+BEGIN_SRC emacs-lisp
+  (load-file "~/.emacs.d/extra/tool-bar+.el")
+  (require 'tool-bar+)
+  (add-hook 'gud-mode-hook (lambda () (tool-bar-here-mode 1)))
+#+END_SRC
+
 ** Réponses par y ou n
 #+BEGIN_SRC emacs-lisp
   (fset 'yes-or-no-p 'y-or-n-p)
@@ -91,7 +101,9 @@ Affiche les numéros des lignes en marge de gauche.
         (add-hook 'pdf-view-mode-hook (lambda () (display-line-numbers-mode -1)))
         (add-hook 'compilation-mode-hook (lambda () (display-line-numbers-mode -1))))
         (add-hook 'magit-mode-hook (lambda () (display-line-numbers-mode -1)))
-        (add-hook 'ediff-display-help-hook (lambda () (display-line-numbers-mode -1))))
+        (add-hook 'ediff-display-help-hook (lambda () (display-line-numbers-mode -1)))
+        (add-hook 'gud-mode-hook (lambda () (display-line-numbers-mode -1)))
+        (add-hook 'speedbar-before-popup-hook (lambda () (display-line-numbers-mode -1))))
 #+END_SRC
 
 ** Powerline
diff --git a/extra/tool-bar+.el b/extra/tool-bar+.el
new file mode 100644
index 0000000..429e3c3
--- /dev/null
+++ b/extra/tool-bar+.el
@@ -0,0 +1,222 @@
+;;; tool-bar+.el --- Extensions to standard library tool-bar.el
+;;
+;; Filename: tool-bar+.el
+;; Description: Extensions to standard library tool-bar.el
+;; Author: Drew Adams
+;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
+;; Copyright (C) 2004-2018, Drew Adams, all rights reserved.
+;; Created: Tue Oct 05 17:02:16 2004
+;; Version: 0
+;; Package-Requires: ()
+;; Last-Updated: Mon Jan  1 16:11:33 2018 (-0800)
+;;           By: dradams
+;;     Update #: 253
+;; URL: https://www.emacswiki.org/emacs/download/tool-bar%2b.el
+;; Doc URL: https://emacswiki.org/emacs/ToolBar
+;; Keywords: tool-bar, convenience, mouse, button, frame
+;; Compatibility: GNU Emacs: 21.x, 22.x, 23.x, 24.x, 25.x, 26.x
+;;
+;; Features that might be required by this library:
+;;
+;;   None
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;;  Extensions to standard library tool-bar.el.
+;;
+;;  New commands defined here:
+;;
+;;    `show-tool-bar-for-one-command', `tool-bar-here-mode',
+;;    `tool-bar-pop-up-mode'.
+;;
+;;
+;;  New key bound here: [menu-bar pop-up-tool-bar]
+;;
+;;
+;;  Usage:
+;;
+;;    Load this library: (require 'tool-bar+).
+;;    Turn on tool-bar pop-up mode: M-x tool-bar-pop-up-mode.
+;;
+;;    Click "Buttons" in the menu-bar to access the tool-bar when you
+;;    need it.  This displays the tool-bar buttons just long enough
+;;    for one command: after you click a tool-bar button, the tool-bar
+;;    disappears again.
+;;
+;;    The advantage of `tool-bar-pop-up-mode' is that you do not lose
+;;    frame real estate to the tool-bar -- you have it when you need
+;;    it, at the cost of an extra click ("Buttons").
+;;
+;;    In addition to defining minor mode `tool-bar-pop-up-mode', this
+;;    library defines minor mode `tool-bar-here-mode', which is the
+;;    same as the global `tool-bar-mode' except that it affects only
+;;    the current frame.
+;;
+;;    The advantage of `tool-bar-here-mode' is (again) that it saves
+;;    real estate on frames other than the ones with the tool-bar.
+;;
+;;
+;;  Put this in your initialization file (`~/.emacs'):
+;;
+;;  (require 'tool-bar+) ; load this library
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Change Log:
+;;
+;; 2013/07/23 dadams
+;;     Remove make-variable-frame-local for tool-bar-here-mode, since deprecated.
+;;     tool-bar-here-mode: Add tool-bar-here-mode as frame parameter.
+;;     tool-bar-pop-up-mode:
+;;       Test frame param tool-bar-here-mode, not frame-local var tool-bar-here-mode.
+;; 2011/01/04 dadams
+;;     Added autoload cookies (for commands).
+;; 2008/04/24 dadams
+;;     Use add-to-list, not setq, for menu-bar-final-items.
+;; 2006/09/15 dadams
+;;     show-tool-bar-for-one-command:
+;;       Clear keystrokes echoed so far and prevent echoing, so can see tool-tips.
+;; 2006/01/07 dadams
+;;     Added :link.
+;; 2004/10/10 dadams
+;;     Added condition-case in show-tool-bar-for-one-command.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; 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 2, 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; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Code:
+
+
+
+;;; Local Tool Bar Mode -------------------------
+
+;;;###autoload
+(define-minor-mode tool-bar-here-mode
+    "Toggle use of the tool bar on this frame only.
+With numeric ARG, display the tool bar if and only if ARG is positive.
+
+See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
+conveniently adding tool bar items."
+  :init-value nil :global t :group 'mouse :group 'frames
+
+  ;; Emacs 24 allows this, but we want things to work also for Emacs 22-23:
+  ;; :variable (frame-parameter nil 'tool-bar-here-mode)
+
+  :link `(url-link :tag "Send Bug Report"
+                   ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\
+tool-bar+.el bug: \
+&body=Describe bug here, starting with `emacs -q'.  \
+Don't forget to mention your Emacs and library versions."))
+  :link '(url-link :tag "Other Libraries by Drew"
+          "https://www.emacswiki.org/emacs/DrewsElispLibraries")
+  :link '(url-link :tag "Download"
+          "https://www.emacswiki.org/emacs/download/tool-bar%2b.el")
+  :link '(url-link :tag "Description"
+          "https://www.emacswiki.org/emacs/ToolBar#Tool-Bar%20Plus")
+  :link '(emacs-commentary-link :tag "Commentary" "tool-bar+")
+  (and (display-images-p)
+       (let ((lines (if tool-bar-here-mode 1 0)))
+         ;; Alter existing frame...
+         (modify-frame-parameters (selected-frame)
+                                  `((tool-bar-lines . ,lines)
+                                    (tool-bar-here-mode . ,tool-bar-here-mode))))
+       (if (and tool-bar-here-mode
+                (display-graphic-p)
+                (= 1 (length (default-value 'tool-bar-map)))) ; not yet set up
+           (tool-bar-setup))))
+
+;;; Pop-Up Tool Bar Mode ------------------------
+
+;; If either of the normal tool-bar modes is turned on, then
+;; `tool-bar-popup-mode' is not available.
+(define-key global-map [menu-bar pop-up-tool-bar]
+  '(menu-item
+    "Buttons" show-tool-bar-for-one-command
+    :visible (and tool-bar-pop-up-mode
+              (not tool-bar-mode)
+              (not (frame-parameter nil 'tool-bar-here-mode)))
+    :enable  (and tool-bar-pop-up-mode
+              (not tool-bar-mode)
+              (not (frame-parameter nil 'tool-bar-here-mode)))
+    :help "Use tool bar for one command"))
+
+(add-to-list 'menu-bar-final-items 'pop-up-tool-bar 'append)
+
+
+;;;###autoload
+(define-minor-mode tool-bar-pop-up-mode
+  "Toggle tool-bar pop-up.
+With numeric ARG, turn on tool-bar pop-up if and only if ARG is positive.
+
+Note: Command `tool-bar-pop-up-mode' functions as a toggle only
+      if neither `tool-bar-mode' nor `tool-bar-here-mode' is on.
+
+      If either of those modes is on, then command
+      `tool-bar-pop-up-mode' turns them both off and turns
+      `tool-bar-pop-up-mode' on."
+  :init-value nil :global t :group 'mouse :group 'frames
+  (when (or tool-bar-mode (frame-parameter nil 'tool-bar-here-mode))
+    (setq tool-bar-pop-up-mode t)
+    (tool-bar-mode -99)
+    (tool-bar-here-mode -99)))
+
+
+
+;; Note: This treats mouse events specially: it scrolls the buffer
+;; text (window) down to compensate for the disappearance of the
+;; tool-bar.  That is, it replaces the tool-bar with an equivalent
+;; number of lines of buffer text.
+;;
+;; This is so that the place where you click the mouse when the
+;; tool-bar is visible corresponds to the place where the mouse is
+;; after the tool-bar disappears.  Otherwise, the buffer text moves
+;; up, relative to the mouse, and a region is selected (without ever
+;; physically moving the mouse).
+;;
+;;;###autoload
+(defun show-tool-bar-for-one-command ()
+  "Pop up the tool bar so you can click a button.
+The tool bar stays visible until one command is executed
+\(whether or not it was initiated by clicking a button)."
+  (interactive)
+  (unless tool-bar-pop-up-mode
+    (error "You must turn on `tool-bar-pop-up-mode' to use this command"))
+  (let (evnt tb-lines)
+    (unwind-protect
+         (let ((echo-keystrokes nil))
+           (tool-bar-here-mode 99)      ; Show tool-bar
+           (message (current-message))  ; Show tool-tip through keystrokes echoed so far
+           (setq evnt (read-event))
+           (push evnt unread-command-events))
+      (when (and (consp evnt)
+                 (member (event-basic-type (car evnt)) '(mouse-1 mouse-2 mouse-3)))
+        (setq tb-lines (cdr (assq 'tool-bar-lines (frame-parameters (selected-frame)))))
+        (condition-case nil
+            (when tb-lines (scroll-down tb-lines))
+          (error (tool-bar-here-mode -99)))) ; E.g. "Beginning of buffer" error
+      (tool-bar-here-mode -99))))            ; Hide tool-bar
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(provide 'tool-bar+)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; tool-bar+.el ends here
-- 
GitLab