unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Klimov <alserkli@inbox.ru>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: patch for completion in octave
Date: Wed, 9 Feb 2011 16:00:23 +0200	[thread overview]
Message-ID: <TheMailAgent.755e20e1b5b814@32293d178731f9c1c8d30> (raw)
In-Reply-To: <jwvzkq6xpyd.fsf-monnier+emacs@gnu.org>

Hi.

On Tue, 8 Feb 2011, Stefan Monnier wrote:
> So, could you try the patch below instead for a little while and see if
> it fixes your problem (it should) and if it doesn't introduce
> other issues?

Your patch is also a good idea since it removes a code duplication,
but besides fixing the original problem, it evinces that we have

    (modify-syntax-entry ?. "w"   table)
    (modify-syntax-entry ?_ "w"   table)

in octave-mod.el, that makes M-f or M-b on something like

 var.field.subfield_1

too greedy.

I must admit that I am too new to octave-mode, so I suspect I am not
qualified to test the changes.

Besides the original problem with completion, during testing I noticed
that octave-help is not a command (btw, would not it be a good idea
for define-key to warn that its argument is not a command, instead of
reporting an error when the key is pressed?).

In the menu "Lookup Octave Index" does not work since info-lookup-mode
is not set (maybe we should set lookup mode "globally" instead and
remove octave-help?).

There is also a problem with completion-addsuffix, since `v<Tab>'
gives `var ' and now the user has to press DEL to continue with
`.field' (btw, since the structure completion is possible, I added `.'
into the skip pattern below).

Together with your patch the following is supposed to fix all the
problems (but, again, I doubt the quality of my testing):

=== modified file 'lisp/progmodes/octave-inf.el'
--- lisp/progmodes/octave-inf.el        2011-01-26 08:36:39 +0000
+++ lisp/progmodes/octave-inf.el        2011-02-09 13:20:42 +0000
@@ -267,7 +264,7 @@
   (let* ((end (point))
         (command
          (save-excursion
-           (skip-syntax-backward "w_" (comint-line-beginning-position))
+           (skip-chars-backward "a-zA-Z_." (comint-line-beginning-position))
            (buffer-substring-no-properties (point) end)))
         (proc (get-buffer-process inferior-octave-buffer)))
     (cond (inferior-octave-complete-impossible
@@ -290,9 +287,10 @@
                   (setcdr x (setq y (cdr y)))
                 (setq x y
                       y (cdr y)))))
-          ;; And let comint handle the rest
-          (comint-dynamic-simple-complete
-           command inferior-octave-output-list)))))
+          ;; And let comint handle the rest (without adding a suffix)
+          (let (comint-completion-addsuffix)
+            (comint-dynamic-simple-complete
+             command inferior-octave-output-list))))))

 (defun inferior-octave-dynamic-list-input-ring ()
   "List the buffer's input history in a help buffer."

=== modified file 'lisp/progmodes/octave-mod.el'
--- lisp/progmodes/octave-mod.el        2011-01-25 04:08:28 +0000
+++ lisp/progmodes/octave-mod.el        2011-02-09 13:03:07 +0000
@@ -279,7 +279,7 @@
     ["Submit Bug Report"	octave-submit-bug-report t]
     "-"
     ["Describe Octave Mode"	describe-mode t]
-    ["Lookup Octave Index"	info-lookup-symbol t]))
+    ["Lookup Octave Index"	octave-help t]))

 (defvar octave-mode-syntax-table
   (let ((table (make-syntax-table)))
@@ -299,8 +299,8 @@
     ;; Was "w" for abbrevs, but now that it's not necessary any more,
     (modify-syntax-entry ?\` "."  table)
     (modify-syntax-entry ?\" "\"" table)
-    (modify-syntax-entry ?. "w"   table)
-    (modify-syntax-entry ?_ "w"   table)
+    (modify-syntax-entry ?. "."   table)
+    (modify-syntax-entry ?_ "."   table)
     ;; The "b" flag only applies to the second letter of the comstart
     ;; and the first letter of the comend, i.e. the "4b" below is ineffective.
     ;; If we try to put `b' on the single-line comments, we get a similar
@@ -661,6 +661,7 @@
 (defun octave-help ()
   "Get help on Octave symbols from the Octave info files.
 Look up symbol in the function, operator and variable indices of the info files."
+  (interactive)
   (let ((info-lookup-mode 'octave-mode))
     (call-interactively 'info-lookup-symbol)))


-- 
Regards,
ASK



  reply	other threads:[~2011-02-09 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 12:49 patch for completion in octave Alexander Klimov
2011-02-08 20:39 ` Stefan Monnier
2011-02-09 14:00   ` Alexander Klimov [this message]
2011-04-25 16:32     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TheMailAgent.755e20e1b5b814@32293d178731f9c1c8d30 \
    --to=alserkli@inbox.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).