emacs: control tab buffer cycling, or stack buffer cycling, similar to alt-tab between windows

后端 未结 3 1868
野的像风
野的像风 2021-01-13 16:41

I have consulted this resource: http://www.emacswiki.org/cgi-bin/wiki/ControlTABbufferCycling, and tried buffer-stack.el, which is useful, but I find the user e

3条回答
  •  自闭症患者
    2021-01-13 16:59

    Try out this snippet:

    (defun ctrltab ()
      "List buffers and give it focus"
      (interactive)
      (if (string= "*Buffer List*" (buffer-name))
          ;; Go to next line. Go to first line if end is reached.
          (progn
            (revert-buffer)
            (if (>= (line-number-at-pos)
                    (count-lines (point-min) (point-max)))
                (goto-char (point-min))
              (forward-line)))
        (list-buffers)
        (switch-to-buffer "*Buffer List*")
        (delete-other-windows)
        (forward-line)))
    
    (global-set-key [C-tab] 'ctrltab)
    

    It's often inferior to ido-switch-buffer, but it does its job anyway.

提交回复
热议问题