unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25188: Initialization of `global-edebug-map' is not safe
@ 2016-12-12 23:45 Alexander Shukaev
  2019-10-09  7:27 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shukaev @ 2016-12-12 23:45 UTC (permalink / raw)
  To: 25188

Hi,

first of all, in 'edebug.el', the

;; If you wish to change the default edebug global command prefix, change:
;; (setq edebug-global-prefix "\C-xX")

is invalid because the name of the variable is actually 
`global-edebug-prefix'.  But that's just a minor point.

Consider

(defvar global-edebug-map
   (let ((map (make-sparse-keymap)))

     (define-key map " " 'edebug-step-mode)
     (define-key map "g" 'edebug-go-mode)
     (define-key map "G" 'edebug-Go-nonstop-mode)
     (define-key map "t" 'edebug-trace-mode)
     (define-key map "T" 'edebug-Trace-fast-mode)
     (define-key map "c" 'edebug-continue-mode)
     (define-key map "C" 'edebug-Continue-fast-mode)

     ;; breakpoints
     (define-key map "b" 'edebug-set-breakpoint)
     (define-key map "u" 'edebug-unset-breakpoint)
     (define-key map "x" 'edebug-set-conditional-breakpoint)
     (define-key map "X" 'edebug-set-global-break-condition)

     ;; views
     (define-key map "w" 'edebug-where)
     (define-key map "W" 'edebug-toggle-save-windows)

     ;; quitting
     (define-key map "q" 'top-level)
     (define-key map "Q" 'edebug-top-level-nonstop)
     (define-key map "a" 'abort-recursive-edit)

     ;; statistics
     (define-key map "=" 'edebug-display-freq-count)
     map)
   "Global map of edebug commands, available from any buffer.")

(global-unset-key global-edebug-prefix)
(global-set-key global-edebug-prefix global-edebug-map)

and imagine that somebody has customized `global-map' in such a way that 
it has no "\C-x" prefix command at all.  Then of course the above code 
will fail.  Furthermore, if one does not want to pollute the 
`global-map' with `global-edebug-map', one cannot simply set 
`global-edebug-prefix' to nil because this would also fail.  I believe 
`global-edebug-map' should support the nil value which would mean that 
the above code is disabled completely.

Looking forward to fix.

Regards,
Alexander





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#25188: Initialization of `global-edebug-map' is not safe
  2016-12-12 23:45 bug#25188: Initialization of `global-edebug-map' is not safe Alexander Shukaev
@ 2019-10-09  7:27 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-09  7:27 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25188

Alexander Shukaev <emacs@Alexander.Shukaev.name> writes:

> (global-unset-key global-edebug-prefix)
> (global-set-key global-edebug-prefix global-edebug-map)
>
> and imagine that somebody has customized `global-map' in such a way
> that it has no "\C-x" prefix command at all.  Then of course the above
> code will fail.  Furthermore, if one does not want to pollute the 
> `global-map' with `global-edebug-map', one cannot simply set
> `global-edebug-prefix' to nil because this would also fail.  I believe 
> `global-edebug-map' should support the nil value which would mean that
> the above code is disabled completely.

I've now made it check whether global-edebug-prefix is nil before using
in Emacs 27.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-09  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-12 23:45 bug#25188: Initialization of `global-edebug-map' is not safe Alexander Shukaev
2019-10-09  7:27 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).