emacs24 backtab is undefined , how to define this shortcut-key
Asked Answered
S

0

12

How to define <backtab> short key in emacs24 ?

I had found some solution,

like:

but it isn't work for me.


In the end:

(global-set-key (kbd "<backtab>") 'un-indent-by-removing-4-spaces)
(defun un-indent-by-removing-4-spaces ()
  "remove 4 spaces from beginning of of line"
  (interactive)
  (save-excursion
    (save-match-data
      (beginning-of-line)
      ;; get rid of tabs at beginning of line
      (when (looking-at "^\\s-+")
        (untabify (match-beginning 0) (match-end 0)))
      (when (looking-at "^    ")
        (replace-match "")))))

worked for me !!!

thanks @Drew and @lawlist.

Sewan answered 16/5, 2014 at 4:54 Comment(1)
Be sure that <backtab> is in fact the key you want to bind. The key labeled Tab on your keyboard, when pressed with modifier key Shift, can produce different soft keys for different keyboards and for different versions of Emacs. If, after trying the solution provided by @lawlist, it does not seem to work, check what C-h k says for Shift + Tab. It might not be <backtab>. It might be <S-tab> of <S-iso-lefttab>. Whatever key it tells you is the one you want to bind.Velutinous

© 2022 - 2024 — McMap. All rights reserved.