[ESS] Disable smart-comma in comments
Vitalie Spinu
spinuvit at gmail.com
Fri Feb 10 13:18:53 CET 2012
>>>> Aleksandar Blagotić <aca.blagotic at gmail.com>
>>>> on Fri, 10 Feb 2012 02:13:12 +0100 wrote:
> AFAIK the new function in ESS *smart-comma* is responsible for automatic
> insertion of space after comma. Is it possible to disable that feature
> within comments (pretty much like smart-underscore)?
The availability of smart operators will be configurable on the operator
by operator basis, I just don't yet have a clear idea of how to do
that. So it would premature to implement something ad-hoc right now.
Also comma would be the last operator I would like to disable on
comments; cannot come with one single example in R where space would
not be recommended after comma.
For time being, if you really want it, you can slightly redefine the
function yourself:
(defun ess-smart-comma ()
"If comma is invoched at the process marker of an ESS inferior
buffer, request and execute a command from `ess-handy-commands'
list."
(interactive)
(let ((proc (get-buffer-process (current-buffer))))
(if (and proc
(eq (point) (marker-position (process-mark proc))))
(call-interactively
(cdr (assoc (ess-completing-read "Execute" (sort (mapcar 'car ess-handy-commands) 'string-lessp) nil t)
ess-handy-commands)))
(if (and ess-smart-operators
(not (ess-inside-string-or-comment-p (point)))) ;; <- added this
(progn
(delete-horizontal-space)
(insert ", "))
(insert ","))
)))
Best,
Vitalie.
More information about the ESS-help
mailing list