all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Live System User <nyc4bos@aol.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: 28687@debbugs.gnu.org
Subject: bug#28687: 25.2; Error using term-handle-ansi-terminal-messages
Date: Mon, 16 Oct 2017 04:01:56 -0400	[thread overview]
Message-ID: <877evvpll7.fsf@aol.com> (raw)
In-Reply-To: <87lgkhayct.fsf@users.sourceforge.net> (Noam Postavsky's message of "Wed, 11 Oct 2017 22:33:54 -0400")

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> tags 28687 + unreproducible moreinfo
> quit
>
> Live System User <nyc4bos@aol.com> writes:
>
>>         When trying to use `term-handle-ansi-terminal-messages`
>>         as a template, a new command code is defined:
>
> Do you mean you have defined some new function?  Please post a complete
> example, not just fragments.

  No: I justed added those lines to the existing
  `term-handle-ansi-terminal-messages`function:


[-- Attachment #2: term-handle-ansi-terminal-messages addition --]
[-- Type: text/plain, Size: 2128 bytes --]

(defun term-handle-ansi-terminal-messages (message)
  ;; Is there a command here?
  (while (string-match "\eAnSiT.+\n" message)
    ;; Extract the command code and the argument.
    (let* ((start (match-beginning 0))
	   (command-code (aref message (+ start 6)))
	   (argument
	    (save-match-data
	      (substring message
			 (+ start 8)
			 (string-match "\r?\n" message
				       (+ start 8)))))
	   ignore)
      ;; Delete this command from MESSAGE.
      (setq message (replace-match "" t t message))

      ;; If we recognize the type of command, set the appropriate variable.
      (cond ((= command-code ?c)
	     (setq term-ansi-at-dir argument))
	    ((= command-code ?h)
	     (setq term-ansi-at-host argument))
	    ((= command-code ?u)
	     (setq term-ansi-at-user argument))
	    ((= command-code ?e)
	     (save-excursion
	      (find-file-other-window argument))
	    ;; Otherwise ignore this one.
	    (t
	     (setq ignore t)))

      ;; Update default-directory based on the changes this command made.
      (if ignore
	  nil
	(setq default-directory
	      (file-name-as-directory
	       (if (and (string= term-ansi-at-host (system-name))
					(string= term-ansi-at-user (user-real-login-name)))
		   (expand-file-name term-ansi-at-dir)
		 (if (string= term-ansi-at-user (user-real-login-name))
		     (concat "/" term-ansi-at-host ":" term-ansi-at-dir)
		   (concat "/" term-ansi-at-user "@" term-ansi-at-host ":"
			   term-ansi-at-dir)))))

	;; I'm not sure this is necessary,
	;; but it's best to be on the safe side.
	(if (string= term-ansi-at-host (system-name))
	    (progn
	      (setq ange-ftp-default-user term-ansi-at-save-user)
	      (setq ange-ftp-default-password term-ansi-at-save-pwd)
	      (setq ange-ftp-generate-anonymous-password term-ansi-at-save-anon))
	  (setq term-ansi-at-save-user ange-ftp-default-user)
	  (setq term-ansi-at-save-pwd ange-ftp-default-password)
	  (setq term-ansi-at-save-anon ange-ftp-generate-anonymous-password)
	  (setq ange-ftp-default-user nil)
	  (setq ange-ftp-default-password nil)
	  (setq ange-ftp-generate-anonymous-password nil)))))
  message)


[-- Attachment #3: Type: text/plain, Size: 1019 bytes --]


>
>>         Most of the time thi works.
>>         
>>         When it doesn't work as expected,
>
> How often does it fail?

  Enough to notice buy no enough to notice a pattern.
  
>
>>            1. I get the error:
>> 
>>               if: Symbol’s value as variable is void:
>>               term-pending-delete-marker
>> 
>> Debugger entered--Lisp error: (void-variable term-pending-delete-marker)
>>   term-emulate-terminal(#<process test> "\nAnSiTe test\nAnSiTu liveuser\nAnSiTc /home/liveuser\nAnSiTh localhost.localdomain\n")
>> 
>
> Seems like you might be running in the wrong buffer.
> term-pending-delete-marker is only defined buffer-locally.

  Since I use `find-file-other-window`, i.e. another buffer,
  why don't I get that error every time that ANSI code is
  processed instead of only occasionally?

  When does `term-pending-delete-marker`kick in?

  Shouldn't it only be a factor as I am typing chacaters and/or
  interacting with the ansi-term?

  Thanks.


  reply	other threads:[~2017-10-16  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 15:19 bug#28687: 25.2; Error using term-handle-ansi-terminal-messages Live System User
2017-10-12  2:33 ` Noam Postavsky
2017-10-16  8:01   ` Live System User [this message]
2017-10-16 23:49     ` Noam Postavsky

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

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

  git send-email \
    --in-reply-to=877evvpll7.fsf@aol.com \
    --to=nyc4bos@aol.com \
    --cc=28687@debbugs.gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.