Skip to content

Commit

Permalink
Merge branch 'trunk'
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Nov 4, 2012
2 parents 3353d00 + 74d1fc1 commit 43d10f1
Show file tree
Hide file tree
Showing 14 changed files with 331 additions and 183 deletions.
71 changes: 62 additions & 9 deletions doc/newfeat.texi
Original file line number Diff line number Diff line change
@@ -1,24 +1,77 @@
@itemize @w{}

Bug Fixes/Changes/New Features in 12.09-1:
Changes/New Features in 12.09-1:
@itemize @bullet
@item @ESS{} @emph{Breaking Changes}: Key changes.

@itemize @minus
@item New keymaps:
@code{ess-doc-map} bound to @kbd{C-c C-d}; @code{ess-extra-map} bound
to @kbd{C-c C-e}; @code{ess-dump-object-into-edit-buffer} was moved on
@kbd{C-c C-e C-d}.
@item roxygen map was moved on @kbd{C-c C-o} and
@kbd{ess-roxy-update-entry} now resides on @kbd{C-c C-o C-o}.
@item handy commands moved to @kbd{C-c C-a}.
@item @code{ess-dev-map} (including @code{ess-tracebug} and @code{ess-developer})
moved on @kbd{C-c C-t}.
@end itemize
@item @ESS{[R]} new command @code{ess-describe-object-at-point}
bound to @kbd{C-c C-d C-e} (repeat @kbd{C-e} or @kbd{e} to cycle). It
was inspired by Erik Iverson's @code{ess-R-object-tooltip} which was
floating around for long time. Customize
@code{ess-describe-at-point-method} to use tooltip instead of an
electric buffer.
@item @ESS{}: new command @code{ess-build-tags-for-directory}
bound to @kbd{C-c C-e C-t} for building dialect specific tag
tables. After building tags you can use @kbd{M-.} to navigate to
function and objects definitions. By default @kbd{C-c C-e C-t} builds
tags based on imenu regular expressions and also include other common
languages @code{.c, .o, .cpp} etc. But it relies on external @code{find}
and @code{etags} commands. If @code{ess-build-tags-command} is defined
(default for R), the inferior process is asked to build the tags. See
@code{ess-build-tags-for-directory} for more details.
@item @ESS{[R]}: new evaluation patter @code{nowait}.
In addition to old @code{nil} and @code{t} values,
@code{ess-eval-visibly} accepts @code{nowait} for a visible evaluation
but with now express waiting for the process. See
@code{ess-eval-visibly} for details on evaluation patterns.
@item @iESS{} process buffer now pops up on errors
@item @ESS{}: @code{ess-switch-process} offers @code{*new*} alternative
to start a new process instead of switching to one of the currently
running processes.
@item @ESS{[R]} ess-roxy: new variable @code{ess-roxy-re} for fontification
of cases where the number of leading @kbd{#} differs from
@code{ess-roxy-str}.
@item @ESS{[R]} Eldoc was considerably enhanced.
It now find even hidden default S3 methods and displays other methods'
arguments.
@item @ESS{[Rnw]} Add knitr support.
Customize @code{ess-swv-processor} for the default processor.
@item @ESS{[Rnw]} more thorough renaming of remaining
@code{noweb-*} to @code{ess-noweb-*}.
@item @ESS{[Rnw]} new commands @code{ess-eval-chunk-and-step} and @code{ess-eval-chunk}
bound to @kbd{M-n C-c} and @kbd{M-n C-M-x} to mirror standard ess
commands in C-c map.
@item @ESS{[R]} Auto-completion integration: new variable
@code{ess-ac-R-argument-suffix} to customize the insertion of trailing
"=". Defaults to `` = ``.
@end itemize

Bug Fixes in 12.09-1:
@itemize @bullet
@item @iESS{[R]} and @iESS{(Sqpe) [S]} on Windows:
The @code{options("editor")} is now initialized to @code{emacsclient}
instead of the previous @code{gnuclient}. The user may need to add the
line @code{(server-start)} to the emacs initialization file.
@code{emacsclient} has been included with emacs since GNU Emacs 22.1.
@item @ESS{[Rnw]} fixed ``connection to R'' bug (in 12.09 only).
@item @ESS{[Rnw]} Fixed ``connection to R'' bug (in 12.09 only).
@item @ESS{[Rnw]} New @code{ess-eval-chunk-and-step} function
functions.
@item @ESS{[Rnw]} Explicit @code{ess-swv-stangle} and @code{ess-swv-sweave}
functions.
@item @ESS{[Rnw]} ess-noweb: more thorough renaming of remaining
@code{noweb-*} to @code{ess-noweb-*}.

@item @ESS{[R]} ess-roxy: new variable @code{ess-roxy-re} for fontification
of cases where the number of leading @kbd{#} differs from @code{ess-roxy-str}.
@item @ESS{[R]} @file{eldoc} rewritten.

@item @ESS{[R]} is more careful with the @code{R} code injection.
It now happens only once at the start of the session.
@item @ESS{[R]}: Fixed auto-scrolling the comint buffer on evaluation.
@end itemize

Changes/New Features in 12.09:
Expand Down
25 changes: 25 additions & 0 deletions etc/in-string-bug-ex.Rnw
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
% From: Richard Morrisroe <richie.morrisroe@gmail.com>
% To: <ess-help@r-project.org>
% Subject: Re: [ESS] noweb file and assignment key
% Date: Tue, 30 Oct 2012 20:57:32 +0000

\documentclass{article}

\begin{document}

<<packages, echo=FALSE, results=hide>>=
i.can.haz.assginment <- TRUE
@

Now, we will introduce an extraneous apostrophe, for no reason '

<<test2>>=
a_2 #ess-smart-underscore-no-longer-works
@

'
<<test3, echo=TRUE, results=verbatim >>=
nowitdoes <- cat("Note the apostrophe above which closes the earlier one\n")
@

\end{document}
22 changes: 8 additions & 14 deletions lisp/ess-custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ as `ess-imenu-use-S'."


(defcustom ess-describe-at-point-method nil
"Whehter `ess-describe-object-at-point' should use tooltip or
not. If nil display in an electric buffer. If 'tooltip display in
an tooltip.
"Whehter `ess-describe-object-at-point' should use a tooltip.
If nil display in an electric buffer. If 'tooltip display in
a tooltip.
See also `tooltip-hide-delay' and `tooltip-delay'.
"
:group 'ess-utils
:type '(choice (const nil) (const tooltip))
:type '(choice (const :tag "buffer" :value nil ) (const tooltip))
)

(defcustom ess-R-describe-object-at-point-commands
Expand Down Expand Up @@ -1062,9 +1062,6 @@ by `ess-function-template'."
:group 'ess
:type 'regexp)

;;;; This is tested for S dialects (actually only for R) -- be careful with it!
(defvar ess-help-arg-regexp "\\(['\"]?\\)\\([^,=)'\"]*\\)\\1"
"Reg(ular) Ex(pression) of help(.) arguments. MUST: 2nd \\(.\\) = arg.")

; ess-inf: variables for inferior-ess.

Expand Down Expand Up @@ -2338,13 +2335,10 @@ the variable `ess-help-own-frame' is non-nil."
Choices are `separate-buffer', `s-process', `www'. The latter uses
`browse-url' to find the location.")

;; WWW Help NOT included yet. Be patient.
(defvar ess-help-w3-url-prefix "http://pyrite.cfas.washington.edu/ESS/R/"
"*Head URL for finding function help.")

(defvar ess-help-w3-url-funs "funs/"
"Place to find functions.")

(defvar ess-help-web-search-command nil
"Dialect specific command web help search.
Passed to `ess-execute-dialect-specific' which see. ")
(make-variable-buffer-local 'ess-help-web-search-command)

(defcustom ess-r-args-noargsmsg "No args found."
"Message returned if \\[ess-r-args-get] cannot find a list of arguments."
Expand Down
106 changes: 76 additions & 30 deletions lisp/ess-help.el
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,12 @@ If COMMAND is suplied, it is used instead of `inferior-ess-help-command'.
(browse-url (funcall fun-get-file-path ess-help-object))))))
)))

(defun ess--action-help-on-object (&optional pos)
(defun ess--action-help-on-object (&optional button)
"Provide help on object at the beginning of line.
It's intended to be used in R-index help pages. Load the package
if necessary. It is bound to RET and C-m in R-index pages."
(interactive)
(let* ((link-beg (previous-single-property-change pos 'button
nil (point-at-bol)))
(link-end (next-single-property-change pos 'button
nil (point-at-eol)))
(string (buffer-substring link-beg link-end))
(let* ((string (button-label button))
(command
(when (equal ess-dialect "R")
(cond ((string-match"::" string)
Expand Down Expand Up @@ -327,7 +323,7 @@ if necessary. It is bound to RET and C-m in R-index pages."
(defun ess--display-indexed-help-page (command item-regexp title help-type
&optional action help-echo reg-start help-object)
"Internal function to display help pages with linked actions
;; COMMAND which produces the help page
;; COMMAND to produce the indexed help page
;; ITEM-REGEXP -- first subexpression is highlighted
;; TITLE of the help page
;; HELP-TYPE to be stored in `ess-help-type' local variable
Expand Down Expand Up @@ -406,21 +402,18 @@ if necessary. It is bound to RET and C-m in R-index pages."
'demos #'ess--action-demo)))


(defun ess--action-demo (&optional pos)
(defun ess--action-demo (&optional button)
"Provide help on object at the beginning of line.
It's intended to be used in R-index help pages. Load the package
if necessary. It is bound to RET and C-m in R-index pages."
(interactive)
(let* ((link-beg (previous-single-property-change pos 'button
nil (point-at-bol)))
(link-end (next-single-property-change pos 'button
nil (point-at-eol)))
(string (buffer-substring link-beg link-end))
(command (cond ((equal ess-dialect "R")
(format "demo('%s')\n" string))
(t (error "Not implemented for dialect %s" ess-dialect))
)))
(ess-eval-linewise command)))
(let* ((string (button-label button))
(command
(cond ((equal ess-dialect "R")
(format "demo('%s')\n" string))
(t (error "Not implemented for dialect %s" ess-dialect)))))
(ess-eval-linewise command)
(ess-switch-to-end-of-ESS)))

(defun ess-display-vignettes ()
"Display vignettes if available for the current dialect."
Expand Down Expand Up @@ -567,18 +560,10 @@ For internal use. Used in `ess-display-help-on-object',



;;; THIS WORKS!
;;(require 'w3)
;(defun ess-display-w3-help-on-object-other-window (object)
; "Display R-documentation for OBJECT using W3"
; (interactive "s Help on :")
; (let* ((ess-help-url (concat ess-help-w3-url-prefix
; ess-help-w3-url-funs
; object
; ".html")))
;;(w3-fetch-other-window ess-help-url)
; ))

(defun ess-help-web-search ()
"Search the web for documentation"
(interactive)
(ess-execute-dialect-specific ess-help-web-search-command "Search for: "))

;;*;; Major mode definition

Expand All @@ -592,6 +577,8 @@ For internal use. Used in `ess-display-help-on-object',
(defvar ess-doc-map
(let (ess-doc-map)
(define-prefix-command 'ess-doc-map)
(define-key ess-doc-map "\C-e" 'ess-describe-object-at-point)
(define-key ess-doc-map "e" 'ess-describe-object-at-point)
(define-key ess-doc-map "\C-d" 'ess-display-help-on-object)
(define-key ess-doc-map "d" 'ess-display-help-on-object)
(define-key ess-doc-map "\C-i" 'ess-display-package-index)
Expand All @@ -600,7 +587,10 @@ For internal use. Used in `ess-display-help-on-object',
(define-key ess-doc-map "a" 'ess-display-help-apropos)
(define-key ess-doc-map "\C-v" 'ess-display-vignettes)
(define-key ess-doc-map "v" 'ess-display-vignettes)
(define-key ess-doc-map "\C-o" 'ess-display-demos)
(define-key ess-doc-map "o" 'ess-display-demos)
(define-key ess-doc-map "\C-w" 'ess-help-web-search)
(define-key ess-doc-map "w" 'ess-help-web-search)
ess-doc-map
)
"ESS documentaion map.")
Expand Down Expand Up @@ -925,6 +915,61 @@ return it. Otherwise, return `ess-help-topics-list'."
;;(other-window 1)
(Info-goto-node (concat "(ess)" node)))


;; describe object at point

(defvar ess-describe-object-at-point-commands nil
"Commands cycled by `ess-describe-object-at-point'. Dialect
specific.")
(make-variable-buffer-local 'ess-describe-at-point-commands)

(defvar ess--descr-o-a-p-commands nil)

(defun ess-describe-object-at-point ()
"Get info for object at point, and display it in an electric buffer or tooltip.
Customize `ess-describe-at-point-method' if you wan to display
the description in a tooltip.
See also `ess-R-describe-object-at-point-commands' (and similar
option for other dialects).
"
(interactive)
(if (not ess-describe-object-at-point-commands)
(message "Not implemented for dialect %s" ess-dialect)
(ess-force-buffer-current)
(let ((map (make-sparse-keymap))
(objname (symbol-at-point))
bs ess--descr-o-a-p-commands)
(unless objname (error "No object at point "))
(define-key map (vector last-command-event) 'ess--describe-object-at-point)
;; todo: put digits into the map
(let ((buf (ess--execute-singlekey-command map nil objname)))
(when (bufferp buf)
(kill-buffer buf))) ;; bury does not work here :( (emacs bug?)
)))

(defun ess--describe-object-at-point (ev objname)
(setq ess--descr-o-a-p-commands (or ess--descr-o-a-p-commands
(symbol-value ess-describe-object-at-point-commands)))
(let* ((com (format (car (pop ess--descr-o-a-p-commands)) objname))
(buf (get-buffer-create "*ess-describe*"))
pos)
(ess-command (concat com "\n") buf)
(with-current-buffer buf
(goto-char (point-min))
(insert (propertize (format "%s:\n\n" com) 'face 'font-lock-string-face))
(forward-line -1)
(setq pos (point))
(setq buffer-read-only t))
(if (eq ess-describe-at-point-method 'tooltip)
(ess-tooltip-show-at-point
(with-current-buffer buf (buffer-string)) 0 30)
(display-buffer buf)
(set-window-point (get-buffer-window buf) pos) ;; don't move window point
buf)))


; Bug Reporting

(defun ess-submit-bug-report ()
Expand Down Expand Up @@ -966,6 +1011,7 @@ return it. Otherwise, return `ess-help-topics-list'."
))))



;;; Provide

(provide 'ess-help)
Expand Down
Loading

0 comments on commit 43d10f1

Please sign in to comment.