Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Little bug when formatting elisp #18

Open
seanirby opened this issue Mar 1, 2016 · 7 comments
Open

Little bug when formatting elisp #18

seanirby opened this issue Mar 1, 2016 · 7 comments

Comments

@seanirby
Copy link

seanirby commented Mar 1, 2016

Hey @tuhdo

Thanks for this package.

I'm generating some lisp code programmatically and I need to format it with your tool after I insert it into a buffer. Works great except for this little bug. Not a big deal for me at all, just thought I would let you know:

starting input

(list :directory "/home/vagrant/Dropbox/dev-shared/shorty/album2/" :name "asdf" :minor-modes (list (quote magit-blame-mode) (quote global-linum-mode)) :text-refs (list :asdf "asdf.el") :playlists (list (list :name "playlist1" :demos nil)))

expected output

(list :directory "/home/vagrant/Dropbox/dev-shared/shorty/album2/"
      :name "asdf"
      :minor-modes (list (quote magit-blame-mode)
                         (quote global-linum-mode))
      :text-ref (list :asdf "asdf.el")
      :playlists (list (list :name "playlist1"
                             :demos nil)))

actual output after executing srefactor-lisp-format-sexp at beginning of buffer

(list :directory "/home/vagrant/Dropbox/dev-shared/shorty/album2/"
      :name "asdf"
      :minor-modes (list (quote magit-blame-mode)
                         (quote global-linum-mode)):text-refs
                         (list :asdf "asdf.el")
                         :playlists (list (list :name "playlist1"
                                                :demos nil)))
@tuhdo
Copy link
Owner

tuhdo commented Mar 1, 2016

Thanks. I will look into it soon.

@matthew-piziak
Copy link

Same here. It doesn't appear to handle property lists well.

(use-package srefactor
  :straight t
  :config (require 'srefactor-lisp)(defun format-emacs-lisp-buffer ()
				     (when (and (eq major-mode 'emacs-lisp-mode)
						(not (s-equals? ".emacs"
								(buffer-name))))
				       (srefactor-lisp-format-buffer)))(add-hook 'before-save-hook #'format-emacs-lisp-buffer)(advice-add 'org-edit-src-save :before #'format-emacs-lisp-buffer))

@matthew-piziak
Copy link

At minimum it should not glue together multiline expressions without line breaks between them.

@matthew-piziak
Copy link

If I change my style and use progn it's okay, but this should not be required.

(use-package srefactor
  :straight t
  :config (progn
	    (require 'srefactor-lisp)
	    (defun format-emacs-lisp-buffer ()
	      (when (and (eq major-mode 'emacs-lisp-mode)
			 (not (s-equals? ".emacs"
					 (buffer-name))))
		(srefactor-lisp-format-buffer)))
	    (add-hook 'before-save-hook #'format-emacs-lisp-buffer)
	    (advice-add 'org-edit-src-save :before #'format-emacs-lisp-buffer)))

@ghost
Copy link

ghost commented May 2, 2020

If I change my style and use progn it's okay, but this should not be required.

Tried out your snippet and now I have lines over 200 characters long due to my extensive use of use-package configs.

@bard
Copy link

bard commented Dec 31, 2020

A long shot after almost five years, but... did anybody find a workaround?

@matthew-piziak
Copy link

@bard I just stopped using srefactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants