unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Changes OK for Emacs 29?
       [not found] <87cz797cyu.fsf.ref@yahoo.com>
@ 2023-01-20  9:49 ` Po Lu
  2023-01-20 13:28   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu @ 2023-01-20  9:49 UTC (permalink / raw)
  To: emacs-devel

Users report that the following changes to two functions are needed for
the Delete key to delete forward correctly on Haiku:

(defun display-symbol-keys-p (&optional display)
  "Return non-nil if DISPLAY supports symbol names as keys.
This means that, for example, DISPLAY can differentiate between
the keybinding RET and [return]."
  (let ((frame-type (framep-on-display display)))
    (or (memq frame-type '(x w32 ns pc pgtk haiku))
        ;; MS-DOS and MS-Windows terminals have built-in support for
        ;; function (symbol) keys
        (memq system-type '(ms-dos windows-nt)))))

(defun normal-erase-is-backspace-setup-frame (&optional frame)
  "Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
  (unless frame (setq frame (selected-frame)))
  (with-selected-frame frame
    (unless (terminal-parameter nil 'normal-erase-is-backspace)
      (normal-erase-is-backspace-mode
       (if (if (eq normal-erase-is-backspace 'maybe)
               (and (not noninteractive)
                    (or (memq system-type '(ms-dos windows-nt))
			(memq window-system '(w32 ns pgtk haiku))
                        (and (eq window-system 'x)
                             (fboundp 'x-backspace-delete-keys-p)
                             (x-backspace-delete-keys-p))
                        ;; If the terminal Emacs is running on has erase char
                        ;; set to ^H, use the Backspace key for deleting
                        ;; backward, and the Delete key for deleting forward.
                        (and (null window-system)
                             (eq tty-erase-char ?\^H))))
             normal-erase-is-backspace)
           1 0)))))

Are they ok for Emacs 29?



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

* Re: Changes OK for Emacs 29?
  2023-01-20  9:49 ` Changes OK for Emacs 29? Po Lu
@ 2023-01-20 13:28   ` Eli Zaretskii
  2023-01-21  0:28     ` Po Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-01-20 13:28 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Date: Fri, 20 Jan 2023 17:49:13 +0800
> 
> Users report that the following changes to two functions are needed for
> the Delete key to delete forward correctly on Haiku:
> 
> (defun display-symbol-keys-p (&optional display)
>   "Return non-nil if DISPLAY supports symbol names as keys.
> This means that, for example, DISPLAY can differentiate between
> the keybinding RET and [return]."
>   (let ((frame-type (framep-on-display display)))
>     (or (memq frame-type '(x w32 ns pc pgtk haiku))
>         ;; MS-DOS and MS-Windows terminals have built-in support for
>         ;; function (symbol) keys
>         (memq system-type '(ms-dos windows-nt)))))
> 
> (defun normal-erase-is-backspace-setup-frame (&optional frame)
>   "Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
>   (unless frame (setq frame (selected-frame)))
>   (with-selected-frame frame
>     (unless (terminal-parameter nil 'normal-erase-is-backspace)
>       (normal-erase-is-backspace-mode
>        (if (if (eq normal-erase-is-backspace 'maybe)
>                (and (not noninteractive)
>                     (or (memq system-type '(ms-dos windows-nt))
> 			(memq window-system '(w32 ns pgtk haiku))
>                         (and (eq window-system 'x)
>                              (fboundp 'x-backspace-delete-keys-p)
>                              (x-backspace-delete-keys-p))
>                         ;; If the terminal Emacs is running on has erase char
>                         ;; set to ^H, use the Backspace key for deleting
>                         ;; backward, and the Delete key for deleting forward.
>                         (and (null window-system)
>                              (eq tty-erase-char ?\^H))))
>              normal-erase-is-backspace)
>            1 0)))))
> 
> Are they ok for Emacs 29?

I don't know.  Please describe the problem, please show the changes
(as diffs, for example), and please explain how these changes fix the
problems.



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

* Re: Changes OK for Emacs 29?
  2023-01-20 13:28   ` Eli Zaretskii
@ 2023-01-21  0:28     ` Po Lu
  2023-01-21  8:24       ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Po Lu @ 2023-01-21  0:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Po Lu <luangruo@yahoo.com>
>> Date: Fri, 20 Jan 2023 17:49:13 +0800
>> 
>> Users report that the following changes to two functions are needed for
>> the Delete key to delete forward correctly on Haiku:
>> 
>> (defun display-symbol-keys-p (&optional display)
>>   "Return non-nil if DISPLAY supports symbol names as keys.
>> This means that, for example, DISPLAY can differentiate between
>> the keybinding RET and [return]."
>>   (let ((frame-type (framep-on-display display)))
>>     (or (memq frame-type '(x w32 ns pc pgtk haiku))
>>         ;; MS-DOS and MS-Windows terminals have built-in support for
>>         ;; function (symbol) keys
>>         (memq system-type '(ms-dos windows-nt)))))
>> 
>> (defun normal-erase-is-backspace-setup-frame (&optional frame)
>>   "Set up `normal-erase-is-backspace-mode' on FRAME, if necessary."
>>   (unless frame (setq frame (selected-frame)))
>>   (with-selected-frame frame
>>     (unless (terminal-parameter nil 'normal-erase-is-backspace)
>>       (normal-erase-is-backspace-mode
>>        (if (if (eq normal-erase-is-backspace 'maybe)
>>                (and (not noninteractive)
>>                     (or (memq system-type '(ms-dos windows-nt))
>> 			(memq window-system '(w32 ns pgtk haiku))
>>                         (and (eq window-system 'x)
>>                              (fboundp 'x-backspace-delete-keys-p)
>>                              (x-backspace-delete-keys-p))
>>                         ;; If the terminal Emacs is running on has erase char
>>                         ;; set to ^H, use the Backspace key for deleting
>>                         ;; backward, and the Delete key for deleting forward.
>>                         (and (null window-system)
>>                              (eq tty-erase-char ?\^H))))
>>              normal-erase-is-backspace)
>>            1 0)))))
>> 
>> Are they ok for Emacs 29?
>
> I don't know.  Please describe the problem, please show the changes
> (as diffs, for example), and please explain how these changes fix the
> problems.

Here are the changes.  It's always possible to tell backspace apart from
delete, and RET from return on Haiku.

diff --git a/lisp/simple.el b/lisp/simple.el
index 4551b749d56..a38426060e0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10317,7 +10317,7 @@ normal-erase-is-backspace-setup-frame
        (if (if (eq normal-erase-is-backspace 'maybe)
                (and (not noninteractive)
                     (or (memq system-type '(ms-dos windows-nt))
-			(memq window-system '(w32 ns pgtk))
+			(memq window-system '(w32 ns pgtk haiku))
                         (and (eq window-system 'x)
                              (fboundp 'x-backspace-delete-keys-p)
                              (x-backspace-delete-keys-p))

diff --git a/lisp/frame.el b/lisp/frame.el
index 322a6f9aa59..fa376788eb0 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2189,7 +2189,7 @@ display-symbol-keys-p
 This means that, for example, DISPLAY can differentiate between
 the keybinding RET and [return]."
   (let ((frame-type (framep-on-display display)))
-    (or (memq frame-type '(x w32 ns pc pgtk))
+    (or (memq frame-type '(x w32 ns pc pgtk haiku))
         ;; MS-DOS and MS-Windows terminals have built-in support for
         ;; function (symbol) keys
         (memq system-type '(ms-dos windows-nt)))))



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

* Re: Changes OK for Emacs 29?
  2023-01-21  0:28     ` Po Lu
@ 2023-01-21  8:24       ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-01-21  8:24 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 21 Jan 2023 08:28:44 +0800
> 
> Here are the changes.  It's always possible to tell backspace apart from
> delete, and RET from return on Haiku.
> 
> diff --git a/lisp/simple.el b/lisp/simple.el
> index 4551b749d56..a38426060e0 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -10317,7 +10317,7 @@ normal-erase-is-backspace-setup-frame
>         (if (if (eq normal-erase-is-backspace 'maybe)
>                 (and (not noninteractive)
>                      (or (memq system-type '(ms-dos windows-nt))
> -			(memq window-system '(w32 ns pgtk))
> +			(memq window-system '(w32 ns pgtk haiku))
>                          (and (eq window-system 'x)
>                               (fboundp 'x-backspace-delete-keys-p)
>                               (x-backspace-delete-keys-p))

"Always" as in "even on TTY frames"?  If so, why haiku is tested only
for GUI frames?

Anyway, this change is fine for the emacs-29 branch.  Thanks.



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

end of thread, other threads:[~2023-01-21  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87cz797cyu.fsf.ref@yahoo.com>
2023-01-20  9:49 ` Changes OK for Emacs 29? Po Lu
2023-01-20 13:28   ` Eli Zaretskii
2023-01-21  0:28     ` Po Lu
2023-01-21  8:24       ` Eli Zaretskii

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).