~ubuntu-branches/ubuntu/saucy/ess/saucy-proposed

« back to all changes in this revision

Viewing changes to lisp/ess-roxy.el

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2010-11-08 16:52:27 UTC
  • mfrom: (1.2.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20101108165227-u844l0tlegcdn89k
Tags: 5.12-1
* New upstream version released today

* debian/emacen-startup: Follow suggestion by Kevin Ryde in #594750 and
  use debian-pkg-add-load-path-item as well; also improved emacsen-install
  script by using soft links instead of copies  (Closes: #594750)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
;; - preview
41
41
;;   - C-c C-e C-r :: create a preview of the Rd file as generated
42
42
;;     using roxygen
 
43
;;     
 
44
;; Known issues:
 
45
;;
 
46
;; - hideshow mode does not work very well. In particular, if ordinary
 
47
;;   comments precede a roxygen entry, then both will be hidden in the
 
48
;;   same overlay from start and not unfoldable using TAB since the
 
49
;;   roxygen prefix is not present. The planned solution is implement
 
50
;;   a replacement for hideshow.
43
51
 
44
52
;; this *is* enabled now via ess-mode-hook in ./ess-site.el
45
53
 
240
248
          (progn
241
249
            (insert (concat "\n"
242
250
                            ess-roxy-str " @param " (car arg-des) " "))
243
 
            (insert (concat (car (cdr arg-des))))
244
 
            (ess-roxy-fill-field))))))
 
251
            (insert 
 
252
             (ess-replace-in-string (concat (car (cdr arg-des))) "\n" 
 
253
                                    (concat "\n" ess-roxy-str)))
 
254
            (if ess-roxy-fill-param-p
 
255
                (ess-roxy-fill-field))
 
256
            )))))
245
257
 
246
258
(defun ess-roxy-merge-args (fun ent)
247
259
  "Take two args lists (alists) and return their union. Result
250
262
drop entries from ent that are not in fun and are associated with
251
263
the empty string."
252
264
  (let ((res-arg nil)
253
 
        (arg-des))
 
265
        (arg-des))                      
254
266
    (while (stringp (car (car fun)))
255
267
      (setq arg-des (pop fun))
256
268
      (if (assoc (car arg-des) ent)
264
276
    (nreverse res-arg)))
265
277
 
266
278
(defun ess-roxy-update-entry ()
267
 
  "Update the current entry or the entry above the function which
268
 
the point is in. Add basic roxygen documentation if no roxygen
269
 
entry is available."
 
279
  "Update the entry at the point or the entry above the function
 
280
which the point is in. Add a template empty roxygen documentation
 
281
if no roxygen entry is available. The template can be customized
 
282
via the variable `ess-roxy-template-alist'. The parameter
 
283
descriptions can are filled if `ess-roxy-fill-param-p' is
 
284
non-nil."
270
285
  (interactive)
271
286
  (save-excursion
272
287
    (let* ((args-fun (ess-roxy-get-args-list-from-def))
376
391
                    (setq args-text (buffer-substring-no-properties
377
392
                                     field-beg field-end))
378
393
                    (setq args-text
379
 
                          (ess-replace-in-string args-text
380
 
                                                 ess-roxy-str ""))
 
394
                          (ess-replace-in-string args-text
 
395
                                                 ess-roxy-str ""))
381
396
                    (setq args-text
382
397
                          (ess-replace-in-string
383
 
                           args-text "@param" ""))
384
 
                    (setq args-text
385
 
                          (ess-replace-in-string args-text "\n" ""))
386
 
                    (setq args-text (replace-regexp-in-string
387
 
                                     "^ +" "" args-text))
388
 
                    (setq arg-name (replace-regexp-in-string
389
 
                                    " .*" ""  args-text))
390
 
                    (setq desc (replace-regexp-in-string
391
 
                                (concat "^" arg-name) "" args-text))
392
 
                    (setq desc (replace-regexp-in-string
393
 
                                "^ +" "" desc))
 
398
                           args-text "[[:space:]]*@param *" ""))
 
399
                    ;; (setq args-text
 
400
                    ;;    (ess-replace-in-string args-text "\n" ""))
 
401
                    (string-match "[^[:space:]]*" args-text)
 
402
                    (setq arg-name (match-string 0 args-text))
 
403
                    (setq desc (replace-regexp-in-string
 
404
                                (concat "^" arg-name " *") "" args-text))
394
405
                    (setq args (cons (list (concat arg-name)
395
406
                                           (concat desc)) args))))
396
407
              (forward-line -1))
502
513
             (ess-beginning-of-function)
503
514
             (buffer-substring-no-properties
504
515
              (progn
505
 
                (search-forward-regexp "function *" nil nil 1)
 
516
                (search-forward-regexp "[=,-] *function *" nil nil 1)
506
517
                (+ (point) 1))
507
518
              (progn
508
519
                (ess-roxy-match-paren)