Comments (19)
How are you marking them, and what did you expect to happen? Do mark commands still work? As in, it is just that the marked region isn't highlighted, or that you can't mark at all?
from tern.
i am marking them with shift and arrows , and mark commands such as mark-word or mark-sexp work, although with arrows i can't mark at all messages buffer outputs :
+1: Mark set
Quit
from tern.
I've never done shift-arrow selection in emacs, not does it work in a vanilla setup. Which setting/minor-mode are you using to get that?
from tern.
I had a similar problem yesterday, but that was using normal C-SPC to set mark. Once the marked region moved over some specific part of the buffer, the mark vanished.
I had no idea what was happening, but next time I'll make sure to disable tern and see if that solves the issue.
from tern.
The emacs API is unfortunately full of subtle side effects. It's very possible that Tern's post-command-hook is causing this. If you can give me a way to reproduce, I'll try to figure out why.
from tern.
If I should wager a guess, it would be with-current-buffer
in tern-run-query
that messes with the mark. I've seen similar issues with with-temp-buffer
at least. I'll let you know if I can reproduce it.
from tern.
@marijnh it does come in my vanilla setup, version 24.3
http://www.gnu.org/software/emacs/manual/html_node/emacs/Shift-Selection.html
you can reproduce it by loading any javascript file, loading js2-mode and for example do set-mark and mark a word inside parenthesis, or even parenthesis alone like a function call: foo() or foo(bar)
from tern.
Yes, quite right. Just set-mark and move point over a function call. Once the type hints pop up, the mark is deactivated.
from tern.
If I turn on shift-select-mode
(or try to reproduce this by setting the mark with C-space), I still don't see this. Whether I start outside of a call, and go inside it, or start inside and go outside, or just move around inside of the call, the mark stays where it used to be. This is Emacs version 24.1.1.
from tern.
I'm on Emacs 24.3.1.
Here's a reproduction:
- create a file under a directory with a .tern-project that has the browser libs.
- type in document.appendChild("abc")
- if you set the mark and move about, everything works fine. This is because the lookup happened when you typed it in.
- so, go to point 1, save the file, kill the buffer, and reopen it.
- set the mark, move forward one char at a time until you reach (
- moving the cursor one more, inside the (, will disable the mark
- this coincides with the lookup of the function signature - the first time.
Doing it again, won't trigger the bug.
However, I have been able to get it triggering every time. Maybe this has
to do with it not finding the function, and so it keeps looking it up.
from tern.
Thanks for the detailed instructions. However, for me, this really doesn't happen. Most likely it's a difference between 24.1 and 24.3. I'll try to upgrade.
from tern.
Unfortunately, no, on 24.3.1 it still isn't happening for me. Very odd.
from tern.
That is weird. It is definitely tern. Here's an ascii-cast with emacs -Q reproducing it:
from tern.
Using your code (conveniently copy-pasted from the asciicast) I can reproduce the problem. I've reduced it to the http request. Simply calling url-http
appears to have the side effect of setting the mark (*Messages*
shows a 'Mark set' message at this point). I haven't been able to figure out why -- there are no calls to set-mark
or similar in the source of the url-http
module.
I suspect this can be solved by shadowing the right dynamic variables. I haven't figured out which one to shadow yet, though.
from tern.
Yes, you're probably right about the shadowing. Have you tried save-excursion tho?
from tern.
Hadn't tried, but it appears save-excursion
also doesn't help.
from tern.
My previous analysis was off, it's not url-http
but json-encode
that causing this, and it is causing it by calling insert
inside a temp buffer. I still haven't found a way to prevent this side effect, and I'm more or less tired of looking. Here's a simple way to reproduce it, if you feel like digging deeper:
(defun shift-selection-disruptor ()
(interactive)
(with-temp-buffer
(insert "x")))
Shift-select something, do M-x, and run shift-selection-disruptor
. The selection will be cleared by the insert
command.
from tern.
Here you go:
(defun shift-selection-disruptor ()
(interactive)
(let (deactivate-mark)
(with-temp-buffer
(insert "x"))))
from tern.
Great! See attached patch.
from tern.
Related Issues (20)
- Website still features "looking for maintainers" spiel HOT 1
- [Bug] The autocompletion for prototype HOT 3
- [BUG] defining the type for the argument of a function HOT 4
- how can i make any use of the !url tag?
- Tern plugin not avaliable in Jenkins
- require.js + defs
- es6 class arrow function method TypeError
- Function information tooltip
- No autocomplete on my objects HOT 2
- Failed to launch development process with webpack after installing tern@latest npm package HOT 2
- Bug fixed. Wrong filename for jump to definition
- acorn-lose error with tern 0.23.3 or up HOT 2
- Simple text search for tern HOT 4
- Is there any way to analyzed code in runtime?
- mix type definitions
- Using `es_modules` and `node` plugin together breaks jump to definition in some cases
- Jump to definition doesn't work from `export` es6 syntax
- Is Tern.js library in active development/support? HOT 9
- Tern not identifying js property references in the given case
- Avoid duplicate name definition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tern.