sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

D1514.stub.patch (2406B)


      1 From 7456a437e59f26b22507ec453bc19d67e45c8673 Mon Sep 17 00:00:00 2001
      2 From: Koichi Murase <myoga.murase@gmail.com>
      3 Date: Mon, 26 Apr 2021 06:36:26 +0900
      4 Subject: [PATCH] stub: keymap_emacs_cursor
      5 
      6 ---
      7  blerc           | 10 ++++++++++
      8  keymap/emacs.sh | 16 +++++++++++++++-
      9  2 files changed, 25 insertions(+), 1 deletion(-)
     10 
     11 diff --git a/blerc b/blerc
     12 index 94c4fc4..3cb6cbe 100644
     13 --- a/blerc
     14 +++ b/blerc
     15 @@ -609,6 +609,16 @@
     16  # ble-color-setface varname_transform         fg=29,bold
     17  # ble-color-setface varname_unset             fg=124
     18  
     19 +##-----------------------------------------------------------------------------
     20 +## Settings for emacs-mode
     21 +
     22 +function blerc/emacs-load-hook {
     23 +  :
     24 +  ## Cursor style
     25 +
     26 +  # bleopt keymap_emacs_cursor=5
     27 +}
     28 +blehook/eval-after-load keymap_emacs blerc/emacs-load-hook
     29  
     30  ##-----------------------------------------------------------------------------
     31  ## Settings for vim-mode
     32 diff --git a/keymap/emacs.sh b/keymap/emacs.sh
     33 index e4842b1..1c20c0e 100644
     34 --- a/keymap/emacs.sh
     35 +++ b/keymap/emacs.sh
     36 @@ -11,6 +11,16 @@ function ble-edit/bind/load-editing-mode:emacs { :; }
     37  # 2021-01-25 force update (change mapping of C-w and M-w)
     38  # 2021-04-26 force update (rename ble/decode/keymap#.register)
     39  
     40 +bleopt/declare -v keymap_emacs_cursor ''
     41 +function bleopt/check:keymap_emacs_cursor {
     42 +  if [[ $_ble_attached ]]; then
     43 +    local ret; bleopt/get:default_keymap
     44 +    [[ $ret == emacs ]] &&
     45 +      ble/term/cursor-state/set-internal "$bleopt_keymap_emacs_cursor"
     46 +  fi
     47 +  return 0
     48 +}
     49 +
     50  #------------------------------------------------------------------------------
     51  
     52  _ble_keymap_emacs_white_list=(
     53 @@ -39,6 +49,10 @@ function ble/keymap:emacs/is-command-white {
     54    return 1
     55  }
     56  
     57 +function ble/widget/emacs/__attach__ {
     58 +  ble/widget/safe/__attach__
     59 +  ble/term/cursor-state/set-internal "$bleopt_keymap_emacs_cursor"
     60 +}
     61  function ble/widget/emacs/__before_widget__ {
     62    if ! ble/keymap:emacs/is-command-white "$WIDGET"; then
     63      ble-edit/undo/add
     64 @@ -154,7 +168,7 @@ function ble-decode/keymap:emacs/define {
     65  
     66    #----------------------------------------------------------------------------
     67  
     68 -  ble-bind -f __attach__        safe/__attach__
     69 +  ble-bind -f __attach__        emacs/__attach__
     70    ble-bind -f __before_widget__ emacs/__before_widget__
     71    ble-bind -f __after_widget__  emacs/__after_widget__
     72    ble-bind -f __line_limit__    __line_limit__
     73 -- 
     74 2.30.0
     75