Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions smart-tabs-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ Smarttabs is enabled in mode hook.")

(defmacro smart-tabs-mode/no-tabs-mode-advice (function)
`(unless (ad-find-advice ',function 'around 'smart-tabs)
(defadvice ,function (around smart-tabs activate)
(define-advice ,function (:around (orig-fun &rest args) smart-tabs)
(if smart-tabs-mode
(let ((indent-tabs-mode nil)) ad-do-it)
ad-do-it))))
(let ((indent-tabs-mode nil)) (apply orig-fun args))
(apply orig-fun args)))))

;;;###autoload
(define-minor-mode smart-tabs-mode
Expand All @@ -225,15 +225,15 @@ Smarttabs is enabled in mode hook.")

(unless
(ad-find-advice 'indent-according-to-mode 'around 'smart-tabs)
(defadvice indent-according-to-mode (around smart-tabs activate)
(define-advice indent-according-to-mode (:around (orig-fun &rest args) smart-tabs)
(if smart-tabs-mode
(let ((indent-tabs-mode indent-tabs-mode))
(if (memq indent-line-function
'(indent-relative
indent-relative-maybe))
(setq indent-tabs-mode nil))
ad-do-it)
ad-do-it)))
(apply orig-fun args))
(apply orig-fun args))))
))

;;;###autoload
Expand All @@ -244,7 +244,7 @@ Smarttabs is enabled in mode hook.")
;;;###autoload
(defmacro smart-tabs-advice (function offset)
`(progn
(defadvice ,function (around smart-tabs activate)
(define-advice ,function (:around (orig-fun &rest args) smart-tabs)
(cond
((and smart-tabs-mode indent-tabs-mode (eq ,offset tab-width))
(save-excursion
Expand All @@ -255,9 +255,9 @@ Smarttabs is enabled in mode hook.")
(let ((tab-width fill-column)
(,offset fill-column))
(unwind-protect
(progn ad-do-it))))
(progn (apply orig-fun args)))))
(t
ad-do-it)))))
(apply orig-fun args))))))

;;;###autoload
(defun smart-tabs-insinuate (&rest languages)
Expand Down