Adaptive fill mode broken in docstring

Đang mở
#660 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
clojure, emacs-lisp
Lĩnh vực
tooling

Hướng nghiên cứu

Tái hiện vấn đề trong Clojure mode bằng cách đặt con trỏ trong phần docstring đã được thụt lề và nhấn M-q. Đọc logic fill liên quan đến docstring có sử dụng adaptive-fill-function và fill-paragraph-function, sau đó so sánh với các major mode Lisp khác. Hoàn tất khi adaptive filling đặt văn bản được ngắt dòng ở mức thụt lề chính xác mà không cần workaround đã được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

When filling in a docstring, there is no proper adaptive filling and it always seems to fill to the beginning column of the docstring. This problem has annoyed me for more than 5 years, so I stepped a bit through the debugger, but I don't understand Emacs Lisp well enough to provide a proper fix.

An arg - asdfasdfasd sadf as dfas df asdf asdf as df as df asd
	 fas df asdf asdf asdf as df asd fa sd fa sdf as df asdf as dfa sdf

Put the cursor somewhere into the indented section and press M-q. In Clojure mode, it will ruin the indentation. Proper adaptive filling will cut as dfa sdf and put in on the next line at col 9.

My best solution so far is to set adaptive-fill-function to ignore and fill-paragraph-function to nil. So far, I haven't observed any adverse side effects but sure it breaks something.

In general, there seems to be a bunch of logic implemented around docstrings in Clojure mode, but it is not very well documented and probably not working properly. Probably one could draw inspiration for how docstring indentation is solved in other LISP major modes.

I noticed that in Emacs Lisp for instance, docstrings have no special indentation behavior, and in Clojure there are two spaces prepended to each line. Its a weird convention but it seems to be somehow rooted in Clojure core? Is that what all the logic is about? Maybe getting rid of that is too much to ask for, but it would be nice if you can make adaptive filling work.

;;; Workaround, use at your own risk
(add-hook 'clojure-mode-hook
		      (lambda ()
			(interactive)
			(setq-local fill-paragraph-function nil)
			(setq-local adaptive-fill-function 'ignore)))
Ngôn ngữ chính
Emacs Lisp
Star
1k
Fork
249
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của clojure-emacs/clojure-mode

Tất cả issue của clojure-emacs/clojure-mode

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.