user2879704
user2879704

Reputation:

Emacs indentation in lisp mode

When i use emacs' lisp indentation, the closing brackets are moved right leaving bigger space infront than necessary. this is how code looks like, And also, in my code in 2nd line, it leaves 2 characters, in 3rd line, it leaves 4 characters... in some places, it is backward indented.....

note: please don't try to decrypt the code, just see how bad the indentation looks like....

(defun tern-req (port doc c)
  (let* 
      (
       (url-mime-charset-string nil) ; Suppress huge, useless header
       (url-request-method "POST"
               )
       (deactivate-mark nil
            ) ; Prevents json-encode from interfering with shift-selection-mode
       (url-request-data 
    (json-encode doc
             )
             )
       (url-show-status nil)
       (url (
         url-parse-make-urlobj "http" nil nil tern-server port "/" nil nil nil
                   )
        )
       )
    (url-http url #'tern-req-finished 
          (list c)
          )
    )
  )

Upvotes: 0

Views: 674

Answers (1)

tripleee
tripleee

Reputation: 189307

Lisp code formatting wars are virtually nonexistent because Emacs is the accepted standard. You should leave the closing parens on the same line, though. A space before a closing paren indicates it's for a bigger block which started on a previous line.

(defun tern-req (port doc c)
  (let* ((url-mime-charset-string nil) ; Suppress huge, useless header
         (url-request-method "POST")
         ;; Prevent json-encode from interfering with shift-selection-mode
         (deactivate-mark nil)
         (url-request-data
          (json-encode doc))
         (url-show-status nil)
         (url
          (url-parse-make-urlobj "http" nil nil tern-server port "/" nil nil nil)) )
    (url-http url #'tern-req-finished
              (list c)) ))

Upvotes: 4

Related Questions