Emacs - 어셈블리에서 탭 들여쓰기를 어떻게 활성화합니까?

Emacs - 어셈블리에서 탭 들여쓰기를 어떻게 활성화합니까?

저는 C 프로그래밍에 emacs를 사용해 왔으며 이제 Assmebly 코드를 작성하려고 합니다. 탭을 누르면 emacs가 공백을 삽입합니다. Tab 키를 사용하여 현재 줄을 식별하도록 하려면 어떻게 해야 합니까?

답변1

노력하다가스 모드내장된 asm 모드 대신.

답변2

사용el-patch:

(el-patch-defun asm-calculate-indentation ()
  (or
   ;; Flush labels to the left margin.
   (and (looking-at "\\(\\sw\\|\\s_\\)+:") 0)
   ;; Same thing for `;;;' comments.
   (and (looking-at "\\s<\\s<\\s<") 0)
   (el-patch-remove
     ;; Simple `;' comments go to the comment-column.
     (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column))
   ;; The rest goes at the first tab stop.
   (or (indent-next-tab-stop 0))))

(defun my--indent-asm-setup ()
  "Set up indentation variables.
Indent with tabs, and make the TAB key behave like it's supposed
to."
  (setq-local indent-tabs-mode t)
  (setq-local tab-always-indent (default-value 'tab-always-indent)))

(add-hook 'asm-mode-hook #'my--indent-asm-setup)

답변3

이대로 두세요. 대부분의 편집자에게는 탭을 공백으로 변환하는 옵션이 있습니다. 편집자가 탭을 공백으로 변환하기를 원하는 이유는 무엇입니까? 코드(저장된 파일 형식 또는 클립보드에 복사)를 가져와 어떤 편집기에서든 사용할 수 있으며 동일하게 보입니다. 강제로 탭을 사용하도록 하고 여기에 붙여넣거나 (우리가) 편집기에서 열면 탭이 특정 크기로 설정되어 있을 수 있으므로 쓰레기처럼 보일 가능성이 높습니다.

공백 대신 탭을 꼭 사용해야 한다면 여기에 게시하거나 다른 사람에게 주기 전에 탭을 공백으로 변환해 주세요.

관련 정보